PHP WebShell

Текущая директория: /usr/lib/node_modules/bitgo/node_modules/@celo/contractkit/lib/wrappers

Просмотр файла: Exchange.d.ts

import { CeloTransactionObject } from '@celo/connect';
import BigNumber from 'bignumber.js';
import { Exchange } from '../generated/Exchange';
import { BaseWrapper } from './BaseWrapper';
export interface ExchangeConfig {
    spread: BigNumber;
    reserveFraction: BigNumber;
    updateFrequency: BigNumber;
    minimumReports: BigNumber;
    lastBucketUpdate: BigNumber;
}
/**
 * Contract that allows to exchange StableToken for GoldToken and vice versa
 * using a Constant Product Market Maker Model aka Mento
 */
export declare class ExchangeWrapper extends BaseWrapper<Exchange> {
    /**
     * Query spread parameter
     * @returns Current spread charged on exchanges
     */
    spread: () => Promise<BigNumber>;
    /**
     * Query reserve fraction parameter
     * @returns Current fraction to commit to the gold bucket
     */
    reserveFraction: () => Promise<BigNumber>;
    /**
     * Query update frequency parameter
     * @returns The time period that needs to elapse between bucket
     * updates
     */
    updateFrequency: () => Promise<BigNumber>;
    /**
     * Query minimum reports parameter
     * @returns The minimum number of fresh reports that need to be
     * present in the oracle to update buckets
     * commit to the gold bucket
     */
    minimumReports: () => Promise<BigNumber>;
    /**
     * Query last bucket update
     * @returns The timestamp of the last time exchange buckets were updated.
     */
    lastBucketUpdate: () => Promise<BigNumber>;
    /**
     * DEPRECATED: use function sell
     * Exchanges sellAmount of sellToken in exchange for at least minBuyAmount of buyToken
     * Requires the sellAmount to have been approved to the exchange
     * @param sellAmount The amount of sellToken the user is selling to the exchange
     * @param minBuyAmount The minimum amount of buyToken the user has to receive for this
     * transaction to succeed
     * @param sellGold `true` if gold is the sell token
     * @return The amount of buyToken that was transfered
     */
    exchange: (sellAmount: BigNumber.Value, minBuyAmount: BigNumber.Value, sellGold: boolean) => CeloTransactionObject<string>;
    /**
     * Sells sellAmount of sellToken in exchange for at least minBuyAmount of buyToken
     * Requires the sellAmount to have been approved to the exchange
     * @param sellAmount The amount of sellToken the user is selling to the exchange
     * @param minBuyAmount The minimum amount of buyToken the user has to receive for this
     * transaction to succeed
     * @param sellGold `true` if gold is the sell token
     * @return The amount of buyToken that was transfered
     */
    sell: (sellAmount: BigNumber.Value, minBuyAmount: BigNumber.Value, sellGold: boolean) => CeloTransactionObject<string>;
    /**
     * Sells sellAmount of sellToken in exchange for at least minBuyAmount of buyToken
     * Requires the sellAmount to have been approved to the exchange
     * @param buyAmount The amount of sellToken the user is selling to the exchange
     * @param maxSellAmount The maximum amount of sellToken the user will sell for this
     * transaction to succeed
     * @param buyGold `true` if gold is the buy token
     * @return The amount of buyToken that was transfered
     */
    buy: (buyAmount: BigNumber.Value, maxSellAmount: BigNumber.Value, buyGold: boolean) => CeloTransactionObject<string>;
    /**
     * @dev Returns the amount of buyToken a user would get for sellAmount of sellToken
     * @param sellAmount The amount of sellToken the user is selling to the exchange
     * @param sellGold `true` if gold is the sell token
     * @return The corresponding buyToken amount.
     */
    getBuyTokenAmount(sellAmount: BigNumber.Value, sellGold: boolean): Promise<BigNumber>;
    /**
     * Returns the amount of sellToken a user would need to exchange to receive buyAmount of
     * buyToken.
     * @param buyAmount The amount of buyToken the user would like to purchase.
     * @param sellGold `true` if gold is the sell token
     * @return The corresponding sellToken amount.
     */
    getSellTokenAmount(buyAmount: BigNumber.Value, sellGold: boolean): Promise<BigNumber>;
    /**
     * Returns the buy token and sell token bucket sizes, in order. The ratio of
     * the two also represents the exchange rate between the two.
     * @param sellGold `true` if gold is the sell token
     * @return [buyTokenBucket, sellTokenBucket]
     */
    getBuyAndSellBuckets: (sellGold: boolean) => Promise<[BigNumber, BigNumber]>;
    /**
     * Sell amount of CELO in exchange for at least minStableAmount of the stable token
     * Requires the amount to have been approved to the exchange
     * @param amount The amount of CELO the user is selling to the exchange
     * @param minStableAmount The minimum amount of the stable token the user has to receive for this
     * transaction to succeed
     */
    sellGold: (amount: BigNumber.Value, minStableAmount: BigNumber.Value) => CeloTransactionObject<string>;
    /**
     * Sell amount of the stable token in exchange for at least minGoldAmount of CELO
     * Requires the amount to have been approved to the exchange
     * @param amount The amount of the stable token the user is selling to the exchange
     * @param minGoldAmount The minimum amount of CELO the user has to receive for this
     * transaction to succeed
     */
    sellStable: (amount: BigNumber.Value, minGoldAmount: BigNumber.Value) => CeloTransactionObject<string>;
    /**
     * Deprecated alias of sellStable.
     * Sell amount of the stable token in exchange for at least minGoldAmount of CELO
     * Requires the amount to have been approved to the exchange
     * @deprecated use sellStable instead
     * @param amount The amount of the stable token the user is selling to the exchange
     * @param minGoldAmount The minimum amount of CELO the user has to receive for this
     * transaction to succeed
     */
    sellDollar: (amount: BigNumber.Value, minGoldAmount: BigNumber.Value) => CeloTransactionObject<string>;
    /**
     * Buy amount of CELO in exchange for at most maxStableAmount of the stable token
     * Requires the amount to have been approved to the exchange
     * @param amount The amount of CELO the user is buying from the exchange
     * @param maxStableAmount The maximum amount of the stable token the user will pay for this
     * transaction to succeed
     */
    buyGold: (amount: BigNumber.Value, maxStableAmount: BigNumber.Value) => CeloTransactionObject<string>;
    /**
     * Buy amount of the stable token in exchange for at least minGoldAmount of CELO
     * Requires the amount to have been approved to the exchange
     * @param amount The amount of the stable token the user is selling to the exchange
     * @param maxGoldAmount The maximum amount of CELO the user will pay for this
     * transaction to succeed
     */
    buyStable: (amount: BigNumber.Value, maxGoldAmount: BigNumber.Value) => CeloTransactionObject<string>;
    /**
     * Deprecated alias of buyStable.
     * Buy amount of the stable token in exchange for at least minGoldAmount of CELO
     * Requires the amount to have been approved to the exchange
     * @deprecated use buyStable instead
     * @param amount The amount of the stable token the user is selling to the exchange
     * @param maxGoldAmount The maximum amount of CELO the user will pay for this
     * transaction to succeed
     */
    buyDollar: (amount: BigNumber.Value, maxGoldAmount: BigNumber.Value) => CeloTransactionObject<string>;
    /**
     * Returns the amount of CELO a user would get for sellAmount of the stable token
     * @param sellAmount The amount of the stable token the user is selling to the exchange
     * @return The corresponding CELO amount.
     */
    quoteStableSell: (sellAmount: BigNumber.Value) => Promise<BigNumber>;
    /**
     * Deprecated alias of quoteStableSell.
     * Returns the amount of CELO a user would get for sellAmount of the stable token
     * @deprecated Use quoteStableSell instead
     * @param sellAmount The amount of the stable token the user is selling to the exchange
     * @return The corresponding CELO amount.
     */
    quoteUsdSell: (sellAmount: BigNumber.Value) => Promise<BigNumber>;
    /**
     * Returns the amount of the stable token a user would get for sellAmount of CELO
     * @param sellAmount The amount of CELO the user is selling to the exchange
     * @return The corresponding stable token amount.
     */
    quoteGoldSell: (sellAmount: BigNumber.Value) => Promise<BigNumber>;
    /**
     * Returns the amount of CELO a user would need to exchange to receive buyAmount of
     * the stable token.
     * @param buyAmount The amount of the stable token the user would like to purchase.
     * @return The corresponding CELO amount.
     */
    quoteStableBuy: (buyAmount: BigNumber.Value) => Promise<BigNumber>;
    /**
     * Deprecated alias of quoteStableBuy.
     * Returns the amount of CELO a user would need to exchange to receive buyAmount of
     * the stable token.
     * @deprecated Use quoteStableBuy instead
     * @param buyAmount The amount of the stable token the user would like to purchase.
     * @return The corresponding CELO amount.
     */
    quoteUsdBuy: (buyAmount: BigNumber.Value) => Promise<BigNumber>;
    /**
     * Returns the amount of the stable token a user would need to exchange to receive buyAmount of
     * CELO.
     * @param buyAmount The amount of CELO the user would like to purchase.
     * @return The corresponding stable token amount.
     */
    quoteGoldBuy: (buyAmount: BigNumber.Value) => Promise<BigNumber>;
    /**
     * @dev Returns the current configuration of the exchange contract
     * @return ExchangeConfig object
     */
    getConfig(): Promise<ExchangeConfig>;
    /**
     * @dev Returns human readable configuration of the exchange contract
     * @return ExchangeConfig object
     */
    getHumanReadableConfig(): Promise<{
        updateFrequency: string;
        lastBucketUpdate: string;
        spread: BigNumber;
        reserveFraction: BigNumber;
        minimumReports: BigNumber;
    }>;
    /**
     * Returns the exchange rate estimated at buyAmount.
     * @param buyAmount The amount of buyToken in wei to estimate the exchange rate at
     * @param sellGold `true` if gold is the sell token
     * @return The exchange rate (number of sellTokens received for one buyToken).
     */
    getExchangeRate(buyAmount: BigNumber.Value, sellGold: boolean): Promise<BigNumber>;
    /**
     * Returns the exchange rate for the stable token estimated at the buyAmount
     * @param buyAmount The amount of the stable token in wei to estimate the exchange rate at
     * @return The exchange rate (number of CELO received for one stable token)
     */
    getStableExchangeRate: (buyAmount: BigNumber.Value) => Promise<BigNumber>;
    /**
     * Deprecated alias of getStableExchangeRate.
     * Returns the exchange rate for the stable token estimated at the buyAmount
     * @deprecated Use getStableExchangeRate instead
     * @param buyAmount The amount of the stable token in wei to estimate the exchange rate at
     * @return The exchange rate (number of CELO received for one stable token)
     */
    getUsdExchangeRate: (buyAmount: BigNumber.Value) => Promise<BigNumber>;
    /**
     * Returns the exchange rate for CELO estimated at the buyAmount
     * @param buyAmount The amount of CELO in wei to estimate the exchange rate at
     * @return The exchange rate (number of stable tokens received for one CELO)
     */
    getGoldExchangeRate: (buyAmount: BigNumber.Value) => Promise<BigNumber>;
}
export declare type ExchangeWrapperType = ExchangeWrapper;

Выполнить команду


Для локальной разработки. Не используйте в интернете!