UNPKG

@fleupold/dex-contracts

Version:

Contracts for dFusion multi-token batch auction exchange

53 lines (52 loc) 2.84 kB
import Web3 from "web3"; import { EpochTokenLockerInstance, BatchExchangeInstance } from "../types/truffle-typings"; import { Deposit, Order } from "./resources/examples/model"; /** * Wait for n (evm) seconds to pass * @param seconds - time to wait * @param web3Provider - potentially different in contract tests and system end-to-end testing. */ export declare function waitForNSeconds(seconds: number, web3Provider?: Web3): Promise<void>; export declare function closeAuction(instance: BatchExchangeInstance | EpochTokenLockerInstance, web3Provider?: Web3): Promise<void>; export declare function sendTxAndGetReturnValue<T>(method: { sendTransaction: (...args: any[]) => Promise<string>; call: (...args: any[]) => Promise<T>; }, ...args: any[]): Promise<T>; /** * Finalizes user's pending deposits by updating user's balances for all input tokens. * It assumes no withdrawals have been requested. * State of the contract after the execution of this function for tokenAddress: * ``` * balanceState[userAddress][tokenAddress] = { * balance: pendingDepositAmount, * pendingDeposits: null, * pendingWithdraws: null, * } * ``` * @param userAddress - address of the user who deposited * @param epochTokenLocker - instance of the epoch token locker to which the user deposited * @param tokenAddresses - list of token addresses for which a deposit is pending */ export declare function applyBalances(userAddress: string, epochTokenLocker: BatchExchangeInstance | EpochTokenLockerInstance, tokenAddresses: string[]): Promise<void>; /** * Makes deposit transactions from a list of Deposit Objects * @param numTokens - number of tokens to be registered on this exchange. * @param maxTokens - Maximum number of tokens (a contract contructor parameter) */ export declare const setupGenericStableX: (numTokens?: number, maxTokens?: number) => Promise<BatchExchangeInstance>; /** * Makes deposit transactions from a list of Deposit Objects * @param contract - BatchExchange smart contract * @param accounts - An array of (unlocked) ethereum account addresses * @param depositList - Array of Deposit Objects * @param sufficiencyFactor - Factor of deposit amount to be deposited (default: 1) */ export declare function makeDeposits(contract: BatchExchangeInstance, accounts: string[], depositList: Deposit[], sufficiencyFactor?: number): Promise<void>; /** * Makes placeOrder transactions from a list of Order Objects * @param contract - BatchExchange smart contract * @param accounts - An array of (unlocked) ethereum account addresses * @param orderList - An array of Order Objects * @param auctionIndex - The auction in which the order should be placed */ export declare function placeOrders(contract: BatchExchangeInstance, accounts: string[], orderList: Order[], auctionIndex: number): Promise<number[]>;