diff --git a/abi/dodoAbi.json b/abi/dodoAbi.json new file mode 100644 index 0000000..5fe6b66 --- /dev/null +++ b/abi/dodoAbi.json @@ -0,0 +1,947 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "buyer", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "receiveBase", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "payQuote", + "type": "uint256" + } + ], + "name": "BuyBaseToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "maintainer", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isBaseToken", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ChargeMaintainerFee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isBaseToken", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ChargePenalty", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "baseTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "quoteTokenAmount", + "type": "uint256" + } + ], + "name": "ClaimAssets", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isBaseToken", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lpTokenAmount", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isBaseToken", + "type": "bool" + } + ], + "name": "Donate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferPrepared", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "seller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "payBase", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "receiveQuote", + "type": "uint256" + } + ], + "name": "SellBaseToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldGasPriceLimit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newGasPriceLimit", + "type": "uint256" + } + ], + "name": "UpdateGasPriceLimit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldK", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newK", + "type": "uint256" + } + ], + "name": "UpdateK", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldLiquidityProviderFeeRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newLiquidityProviderFeeRate", + "type": "uint256" + } + ], + "name": "UpdateLiquidityProviderFeeRate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldMaintainerFeeRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaintainerFeeRate", + "type": "uint256" + } + ], + "name": "UpdateMaintainerFeeRate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isBaseToken", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "lpTokenAmount", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "_BASE_BALANCE_", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_BASE_CAPITAL_RECEIVE_QUOTE_", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_BASE_CAPITAL_TOKEN_", + "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_BASE_TOKEN_", + "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{"internalType": "address", "name": "", "type": "address"}], + "name": "_CLAIMED_", + "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_CLOSED_", + "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_DEPOSIT_BASE_ALLOWED_", + "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_DEPOSIT_QUOTE_ALLOWED_", + "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_GAS_PRICE_LIMIT_", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_K_", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_LP_FEE_RATE_", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_MAINTAINER_", + "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_MT_FEE_RATE_", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_NEW_OWNER_", + "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_ORACLE_", + "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_OWNER_", + "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_QUOTE_BALANCE_", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_QUOTE_CAPITAL_RECEIVE_BASE_", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_QUOTE_CAPITAL_TOKEN_", + "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_QUOTE_TOKEN_", + "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_R_STATUS_", + "outputs": [ + {"internalType": "enum Types.RStatus", "name": "", "type": "uint8"} + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_SUPERVISOR_", + "outputs": [{"internalType": "address", "name": "", "type": "address"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_TARGET_BASE_TOKEN_AMOUNT_", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_TARGET_QUOTE_TOKEN_AMOUNT_", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_TRADE_ALLOWED_", + "outputs": [{"internalType": "bool", "name": "", "type": "bool"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + {"internalType": "uint256", "name": "amount", "type": "uint256"}, + {"internalType": "uint256", "name": "maxPayQuote", "type": "uint256"}, + {"internalType": "bytes", "name": "data", "type": "bytes"} + ], + "name": "buyBaseToken", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "claimAssets", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "claimOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "uint256", "name": "amount", "type": "uint256"} + ], + "name": "depositBase", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "address", "name": "to", "type": "address"}, + {"internalType": "uint256", "name": "amount", "type": "uint256"} + ], + "name": "depositBaseTo", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "uint256", "name": "amount", "type": "uint256"} + ], + "name": "depositQuote", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "address", "name": "to", "type": "address"}, + {"internalType": "uint256", "name": "amount", "type": "uint256"} + ], + "name": "depositQuoteTo", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "disableBaseDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "disableQuoteDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "disableTrading", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "uint256", "name": "amount", "type": "uint256"} + ], + "name": "donateBaseToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "uint256", "name": "amount", "type": "uint256"} + ], + "name": "donateQuoteToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "enableBaseDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "enableQuoteDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "enableTrading", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "finalSettlement", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{"internalType": "address", "name": "lp", "type": "address"}], + "name": "getBaseCapitalBalanceOf", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getExpectedTarget", + "outputs": [ + {"internalType": "uint256", "name": "baseTarget", "type": "uint256"}, + {"internalType": "uint256", "name": "quoteTarget", "type": "uint256"} + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{"internalType": "address", "name": "lp", "type": "address"}], + "name": "getLpBaseBalance", + "outputs": [ + {"internalType": "uint256", "name": "lpBalance", "type": "uint256"} + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{"internalType": "address", "name": "lp", "type": "address"}], + "name": "getLpQuoteBalance", + "outputs": [ + {"internalType": "uint256", "name": "lpBalance", "type": "uint256"} + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMidPrice", + "outputs": [ + {"internalType": "uint256", "name": "midPrice", "type": "uint256"} + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getOraclePrice", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{"internalType": "address", "name": "lp", "type": "address"}], + "name": "getQuoteCapitalBalanceOf", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalBaseCapital", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalQuoteCapital", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + {"internalType": "uint256", "name": "amount", "type": "uint256"} + ], + "name": "getWithdrawBasePenalty", + "outputs": [ + {"internalType": "uint256", "name": "penalty", "type": "uint256"} + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + {"internalType": "uint256", "name": "amount", "type": "uint256"} + ], + "name": "getWithdrawQuotePenalty", + "outputs": [ + {"internalType": "uint256", "name": "penalty", "type": "uint256"} + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + {"internalType": "address", "name": "owner", "type": "address"}, + {"internalType": "address", "name": "supervisor", "type": "address"}, + {"internalType": "address", "name": "maintainer", "type": "address"}, + {"internalType": "address", "name": "baseToken", "type": "address"}, + {"internalType": "address", "name": "quoteToken", "type": "address"}, + {"internalType": "address", "name": "oracle", "type": "address"}, + {"internalType": "uint256", "name": "lpFeeRate", "type": "uint256"}, + {"internalType": "uint256", "name": "mtFeeRate", "type": "uint256"}, + {"internalType": "uint256", "name": "k", "type": "uint256"}, + {"internalType": "uint256", "name": "gasPriceLimit", "type": "uint256"} + ], + "name": "init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "uint256", "name": "amount", "type": "uint256"} + ], + "name": "queryBuyBaseToken", + "outputs": [ + {"internalType": "uint256", "name": "payQuote", "type": "uint256"} + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + {"internalType": "uint256", "name": "amount", "type": "uint256"} + ], + "name": "querySellBaseToken", + "outputs": [ + {"internalType": "uint256", "name": "receiveQuote", "type": "uint256"} + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + {"internalType": "address", "name": "token", "type": "address"}, + {"internalType": "uint256", "name": "amount", "type": "uint256"} + ], + "name": "retrieve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "uint256", "name": "amount", "type": "uint256"}, + {"internalType": "uint256", "name": "minReceiveQuote", "type": "uint256"}, + {"internalType": "bytes", "name": "data", "type": "bytes"} + ], + "name": "sellBaseToken", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "uint256", "name": "newGasPriceLimit", "type": "uint256"} + ], + "name": "setGasPriceLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{"internalType": "uint256", "name": "newK", "type": "uint256"}], + "name": "setK", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newLiquidityPorviderFeeRate", + "type": "uint256" + } + ], + "name": "setLiquidityProviderFeeRate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "address", "name": "newMaintainer", "type": "address"} + ], + "name": "setMaintainer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaintainerFeeRate", + "type": "uint256" + } + ], + "name": "setMaintainerFeeRate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "address", "name": "newOracle", "type": "address"} + ], + "name": "setOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "address", "name": "newSupervisor", "type": "address"} + ], + "name": "setSupervisor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "address", "name": "newOwner", "type": "address"} + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawAllBase", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{"internalType": "address", "name": "to", "type": "address"}], + "name": "withdrawAllBaseTo", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawAllQuote", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{"internalType": "address", "name": "to", "type": "address"}], + "name": "withdrawAllQuoteTo", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "uint256", "name": "amount", "type": "uint256"} + ], + "name": "withdrawBase", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "address", "name": "to", "type": "address"}, + {"internalType": "uint256", "name": "amount", "type": "uint256"} + ], + "name": "withdrawBaseTo", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "uint256", "name": "amount", "type": "uint256"} + ], + "name": "withdrawQuote", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + {"internalType": "address", "name": "to", "type": "address"}, + {"internalType": "uint256", "name": "amount", "type": "uint256"} + ], + "name": "withdrawQuoteTo", + "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/package-lock.json b/package-lock.json index 14c102b..bc64a18 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1649,6 +1649,14 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz", "integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==" }, + "axios": { + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.20.0.tgz", + "integrity": "sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==", + "requires": { + "follow-redirects": "^1.10.0" + } + }, "babel-cli": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-cli/-/babel-cli-6.26.0.tgz", @@ -4339,6 +4347,11 @@ } } }, + "follow-redirects": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz", + "integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==" + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", diff --git a/package.json b/package.json index 5ab07b1..4c759df 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "@types/es6-promisify": "^6.0.0", "@types/mocha": "^7.0.2", "assert": "^2.0.0", + "axios": "^0.20.0", "babel-cli": "^6.26.0", "babel-eslint": "^10.1.0", "bignumber.js": "^9.0.0", diff --git a/test/Trader.test.ts b/test/Trader.test.ts index 8591724..5e04c6e 100644 --- a/test/Trader.test.ts +++ b/test/Trader.test.ts @@ -52,15 +52,7 @@ describe("Trader", () => { describe("R goes above ONE", () => { it("buy when R equals ONE", async () => { -<<<<<<< Updated upstream - await logGas( - ctx.DODO.methods.buyBaseToken(decimalStr("1"), decimalStr("110"), "0x"), - ctx.sendParam(trader), - "buy base token when balanced" - ); -======= await logGas(ctx.DODO.methods.buyBaseToken(decimalStr("1"), decimalStr("110"), "0x"), ctx.sendParam(trader), "buy base token when balanced") ->>>>>>> Stashed changes // trader balances assert.equal( await ctx.BASE.methods.balanceOf(trader).call(), @@ -96,19 +88,8 @@ describe("Trader", () => { }); it("buy when R is ABOVE ONE", async () => { -<<<<<<< Updated upstream - await ctx.DODO.methods - .buyBaseToken(decimalStr("1"), decimalStr("110"), "0x") - .send(ctx.sendParam(trader)); - await logGas( - ctx.DODO.methods.buyBaseToken(decimalStr("1"), decimalStr("130"), "0x"), - ctx.sendParam(trader), - "buy when R is ABOVE ONE" - ); -======= await ctx.DODO.methods.buyBaseToken(decimalStr("1"), decimalStr("110"), "0x").send(ctx.sendParam(trader)) await logGas(ctx.DODO.methods.buyBaseToken(decimalStr("1"), decimalStr("130"), "0x"), ctx.sendParam(trader), "buy when R is ABOVE ONE") ->>>>>>> Stashed changes // trader balances assert.equal( await ctx.BASE.methods.balanceOf(trader).call(), @@ -139,23 +120,8 @@ describe("Trader", () => { }); it("sell when R is ABOVE ONE", async () => { -<<<<<<< Updated upstream - await ctx.DODO.methods - .buyBaseToken(decimalStr("1"), decimalStr("110"), "0x") - .send(ctx.sendParam(trader)); - await logGas( - ctx.DODO.methods.sellBaseToken( - decimalStr("0.5"), - decimalStr("40"), - "0x" - ), - ctx.sendParam(trader), - "sell when R is ABOVE ONE" - ); -======= await ctx.DODO.methods.buyBaseToken(decimalStr("1"), decimalStr("110"), "0x").send(ctx.sendParam(trader)) await logGas(ctx.DODO.methods.sellBaseToken(decimalStr("0.5"), decimalStr("40"), "0x"), ctx.sendParam(trader), "sell when R is ABOVE ONE") ->>>>>>> Stashed changes // trader balances assert.equal( await ctx.BASE.methods.balanceOf(trader).call(), @@ -186,23 +152,8 @@ describe("Trader", () => { }); it("sell when R is ABOVE ONE and RStatus back to ONE", async () => { -<<<<<<< Updated upstream - await ctx.DODO.methods - .buyBaseToken(decimalStr("1"), decimalStr("110"), "0x") - .send(ctx.sendParam(trader)); - await logGas( - ctx.DODO.methods.sellBaseToken( - "1003002430889317763", - decimalStr("90"), - "0x" - ), - ctx.sendParam(trader), - "sell when R is ABOVE ONE and RStatus back to ONE" - ); -======= await ctx.DODO.methods.buyBaseToken(decimalStr("1"), decimalStr("110"), "0x").send(ctx.sendParam(trader)) await logGas(ctx.DODO.methods.sellBaseToken("1003002430889317763", decimalStr("90"), "0x"), ctx.sendParam(trader), "sell when R is ABOVE ONE and RStatus back to ONE") ->>>>>>> Stashed changes // R status assert.equal(await ctx.DODO.methods._R_STATUS_().call(), "0"); // trader balances @@ -244,19 +195,8 @@ describe("Trader", () => { }); it("sell when R is ABOVE ONE and RStatus becomes BELOW ONE", async () => { -<<<<<<< Updated upstream - await ctx.DODO.methods - .buyBaseToken(decimalStr("1"), decimalStr("110"), "0x") - .send(ctx.sendParam(trader)); - await logGas( - ctx.DODO.methods.sellBaseToken(decimalStr("2"), decimalStr("90"), "0x"), - ctx.sendParam(trader), - "sell when R is ABOVE ONE and RStatus becomes BELOW ONE [gas cost worst case]" - ); -======= await ctx.DODO.methods.buyBaseToken(decimalStr("1"), decimalStr("110"), "0x").send(ctx.sendParam(trader)) await logGas(ctx.DODO.methods.sellBaseToken(decimalStr("2"), decimalStr("90"), "0x"), ctx.sendParam(trader), "sell when R is ABOVE ONE and RStatus becomes BELOW ONE [gas cost worst case]") ->>>>>>> Stashed changes // R status assert.equal(await ctx.DODO.methods._R_STATUS_().call(), "2"); // trader balances @@ -300,15 +240,7 @@ describe("Trader", () => { describe("R goes below ONE", () => { it("sell when R equals ONE", async () => { -<<<<<<< Updated upstream - await logGas( - ctx.DODO.methods.sellBaseToken(decimalStr("1"), decimalStr("90"), "0x"), - ctx.sendParam(trader), - "sell base token when balanced" - ); -======= await logGas(ctx.DODO.methods.sellBaseToken(decimalStr("1"), decimalStr("90"), "0x"), ctx.sendParam(trader), "sell base token when balanced") ->>>>>>> Stashed changes // trader balances assert.equal( await ctx.BASE.methods.balanceOf(trader).call(), @@ -344,19 +276,8 @@ describe("Trader", () => { }); it("sell when R is BELOW ONE", async () => { -<<<<<<< Updated upstream - await ctx.DODO.methods - .sellBaseToken(decimalStr("3"), decimalStr("90"), "0x") - .send(ctx.sendParam(trader)); - await logGas( - ctx.DODO.methods.sellBaseToken(decimalStr("3"), decimalStr("90"), "0x"), - ctx.sendParam(trader), - "sell when R is BELOW ONE" - ); -======= await ctx.DODO.methods.sellBaseToken(decimalStr("3"), decimalStr("90"), "0x").send(ctx.sendParam(trader)) await logGas(ctx.DODO.methods.sellBaseToken(decimalStr("3"), decimalStr("90"), "0x"), ctx.sendParam(trader), "sell when R is BELOW ONE") ->>>>>>> Stashed changes // trader balances assert.equal( await ctx.BASE.methods.balanceOf(trader).call(), @@ -387,23 +308,8 @@ describe("Trader", () => { }); it("buy when R is BELOW ONE", async () => { -<<<<<<< Updated upstream - await ctx.DODO.methods - .sellBaseToken(decimalStr("1"), decimalStr("90"), "0x") - .send(ctx.sendParam(trader)); - await logGas( - ctx.DODO.methods.buyBaseToken( - decimalStr("0.5"), - decimalStr("60"), - "0x" - ), - ctx.sendParam(trader), - "buy when R is BELOW ONE" - ); -======= await ctx.DODO.methods.sellBaseToken(decimalStr("1"), decimalStr("90"), "0x").send(ctx.sendParam(trader)) await logGas(ctx.DODO.methods.buyBaseToken(decimalStr("0.5"), decimalStr("60"), "0x"), ctx.sendParam(trader), "buy when R is BELOW ONE") ->>>>>>> Stashed changes // trader balances assert.equal( await ctx.BASE.methods.balanceOf(trader).call(), @@ -434,23 +340,8 @@ describe("Trader", () => { }); it("buy when R is BELOW ONE and RStatus back to ONE", async () => { -<<<<<<< Updated upstream - await ctx.DODO.methods - .sellBaseToken(decimalStr("1"), decimalStr("90"), "0x") - .send(ctx.sendParam(trader)); - await logGas( - ctx.DODO.methods.buyBaseToken( - "997008973080757728", - decimalStr("110"), - "0x" - ), - ctx.sendParam(trader), - "buy when R is BELOW ONE and RStatus back to ONE" - ); -======= await ctx.DODO.methods.sellBaseToken(decimalStr("1"), decimalStr("90"), "0x").send(ctx.sendParam(trader)) await logGas(ctx.DODO.methods.buyBaseToken("997008973080757728", decimalStr("110"), "0x"), ctx.sendParam(trader), "buy when R is BELOW ONE and RStatus back to ONE") ->>>>>>> Stashed changes // R status assert.equal(await ctx.DODO.methods._R_STATUS_().call(), "0"); // trader balances @@ -492,19 +383,8 @@ describe("Trader", () => { }); it("buy when R is BELOW ONE and RStatus becomes ABOVE ONE", async () => { -<<<<<<< Updated upstream - await ctx.DODO.methods - .sellBaseToken(decimalStr("1"), decimalStr("90"), "0x") - .send(ctx.sendParam(trader)); - await logGas( - ctx.DODO.methods.buyBaseToken(decimalStr("2"), decimalStr("220"), "0x"), - ctx.sendParam(trader), - "buy when R is BELOW ONE and RStatus becomes ABOVE ONE [gas cost worst case]" - ); -======= await ctx.DODO.methods.sellBaseToken(decimalStr("1"), decimalStr("90"), "0x").send(ctx.sendParam(trader)) await logGas(ctx.DODO.methods.buyBaseToken(decimalStr("2"), decimalStr("220"), "0x"), ctx.sendParam(trader), "buy when R is BELOW ONE and RStatus becomes ABOVE ONE [gas cost worst case]") ->>>>>>> Stashed changes // R status assert.equal(await ctx.DODO.methods._R_STATUS_().call(), "1"); // trader balances diff --git a/test/utils/Contracts.ts b/test/utils/Contracts.ts index 245f6e3..7a3a01b 100644 --- a/test/utils/Contracts.ts +++ b/test/utils/Contracts.ts @@ -13,7 +13,6 @@ if (process.env["COVERAGE"]) { const CloneFactory = require(`${jsonPath}CloneFactory.json`) const DODO = require(`${jsonPath}DODO.json`) const DODOZoo = require(`${jsonPath}DODOZoo.json`) -// const DODOWild = require(`${jsonPath}DODOWild.json`) const DODOEthProxy = require(`${jsonPath}DODOEthProxy.json`) const WETH = require(`${jsonPath}WETH9.json`) const TestERC20 = require(`${jsonPath}TestERC20.json`) @@ -22,6 +21,7 @@ const DODOLpToken = require(`${jsonPath}DODOLpToken.json`) const Uniswap = require(`${jsonPath}UniswapV2Pair.json`) const UniswapArbitrageur = require(`${jsonPath}UniswapArbitrageur.json`) const DODOToken = require(`${jsonPath}DODOToken.json`) +const DODOMine = require(`${jsonPath}DODOMine.json`) const LockedTokenVault = require(`${jsonPath}LockedTokenVault.json`) import { getDefaultWeb3 } from './EVM'; @@ -40,6 +40,7 @@ export const UNISWAP_CONTRACT_NAME = "Uniswap" export const UNISWAP_ARBITRAGEUR_CONTRACT_NAME = "UniswapArbitrageur" export const DODO_TOKEN_CONTRACT_NAME = "DODOToken" export const LOCKED_TOKEN_VAULT_CONTRACT_NAME = "LockedTokenVault" +export const DODO_MINE_NAME = "DODOMine" var contractMap: { [name: string]: any } = {} contractMap[CLONE_FACTORY_CONTRACT_NAME] = CloneFactory @@ -54,6 +55,7 @@ contractMap[UNISWAP_CONTRACT_NAME] = Uniswap contractMap[UNISWAP_ARBITRAGEUR_CONTRACT_NAME] = UniswapArbitrageur contractMap[DODO_TOKEN_CONTRACT_NAME] = DODOToken contractMap[LOCKED_TOKEN_VAULT_CONTRACT_NAME] = LockedTokenVault +contractMap[DODO_MINE_NAME] = DODOMine interface ContractJson { abi: any;