diff --git a/audit/Smart contract security audit report-DODO.pdf b/audit/Smart contract security audit report-DODO.pdf new file mode 100644 index 0000000..8d4e2dd Binary files /dev/null and b/audit/Smart contract security audit report-DODO.pdf differ diff --git a/config/mbtest-config.js b/config/mbtest-config.js index 262a3d6..cac44d9 100644 --- a/config/mbtest-config.js +++ b/config/mbtest-config.js @@ -1,47 +1,47 @@ module.exports = { MBTEST_CONFIG: { //TOKEN - WETH: "0x0e1630bd2bc047fF6338F78Dc45410e1c0Fc32a0", + WETH: "0xF8cef78E923919054037a1D03662bBD884fF4edf", CHI: "0x0000000000000000000000000000000000000000", - DODO: "0x1E7727eDad5a2ef47C5AB95a20FEd515735591B2", + DODO: "0x42e2EE7Ba8975c473157634Ac2AF4098190fc741", //Helper - DODOSellHelper: "0xb61c30c1612504d334b39E5172D8215cb5Ad576C", - DODOCalleeHelper: "0x6211feD3b4f22e23Ac77EeB4F31562D17f5A352E", - DODOV1PmmHelper: "0x4D73053013F876e319f07B27B59158Cca01A64C5", - DODOV2RouteHelper: "0xC679Fe3200D0d3c53Ba5cd3dC8e7111eC2DF939b", + DODOSellHelper: "0xe573BCA813c741229ffB2488F7856C6cAa841041", + DODOCalleeHelper: "0xBb0CC0fb3e0c06725c67167501f850B4900D6DB5", + DODOV1PmmHelper: "0xfE5D3c52F7ee9aa32a69b96Bfbb088Ba0bCd8EfC", + DODOV2RouteHelper: "0x750C200d7c7C426da169742f705CA5268e1736b4", //Template - CloneFactory: "0x24B7AB1C9f099f00BCE536d8E3605B53C226623E", - FeeRateModel: "0xfFC36c9F7de34d793e431F784724bC6CB8449CaE", - PermissionManager: "0xB79b78C29756D820895774BfF84A447fEfAd373e", - DVM: "0x85913c7CF9F8624A7f2b2CD34149A214768233d7", - DPP: "0xc04dF41F6382A5dB5752533E0DC93123DaACeD8E", - DPPAdmin: "0x514c9Ae51a8Bf85F4f656F7226bD208F4995247c", - CP: "0x0AE9df8B24E2F3903441F84d632f655B6B93b9dF", - ERC20: "", - MintableERC20: "", + CloneFactory: "0x92496871560a01551E1B4fD04540D7A519D5C19e", + FeeRateModel: "0x63A1519eE99d1121780FFfa1726Ed2eCc6d1611B", + PermissionManager: "0x50275d3F95E0F2FCb2cAb2Ec7A231aE188d7319d", + DVM: "0x596fB37d99bd679d1af76fBCB658f7a1a31A1205", + DPP: "0x4d6942683D051FF95804B08EF11F98A7F41C1b44", + DPPAdmin: "0x79885EBC79783C9174faC36Ed99cD9467CB8cDbE", + CP: "0xe9CC152481642D7a3Ea207E3930067B19663770F", + ERC20: "0x0484C33Bad127FA77CC64d6475aDD6483c70BbB9", + MintableERC20: "0x4FBb399fB0E360e11DFF274090650C7e588F1af1", //Factory - DVMFactory: "0x3d1AF1F66Ee4800a1db87321C9B23ed971eEc2e2", - DPPFactory: "0xBAA57Ff6A08E183917746C999C3FF1dE95eE01fb", - CrowdPoolingFactory: "0x9557b4E0Fe6bd94544E4D43E52C5c8f8F771535b", - ERC20Factory: "", + DVMFactory: "0xFa39bFe0f589aba7315090bDaEbDF617535B130f", + DPPFactory: "0x708bE4dA5e8D8E40dC51A1Dc5987Cc2a7fB22334", + CrowdPoolingFactory: "0xE18691ddF53F52705CBD518dF4c2632adDD8a9e5", + ERC20Factory: "0xC7430D8919b54F85a723810FBceF2114482EC5D1", //Approve - DODOApprove: "0x667A1d5947B2f81D56BFd872285F93BFBc73c632", - DODOApproveProxy: "0x7525A017EAa0feAaF8bA047d37062E03b2492312", + DODOApprove: "0xC683516e791c5E2b8e913dE0670d499927f54CEc", + DODOApproveProxy: "0x1bc238EAd60bdF5e94BB8f7205b6e75ACabACbC0", //Periphery - DODOIncentive: "0x9f871a98413C5fa0D72d0f2AB88C1d9cD58C3383", + DODOIncentive: "0xc5A6D29ed21e63A994A766558cDb055832dbF886", //Adpater - DODOV1Adapter: "", - DODOV2Adapter: "", - UniAdapter: "", + DODOV1Adapter: "0x1a3fa978909d86dF1244216b02733136b438D83E", + DODOV2Adapter: "0x0e1630bd2bc047fF6338F78Dc45410e1c0Fc32a0", + UniAdapter: "0x1E7727eDad5a2ef47C5AB95a20FEd515735591B2", //Proxy - DODOV2Proxy: "0x50d634E43F5aD7748cf2860760b887655524B593", + DODOV2Proxy: "0x58eD6D2faa3C8Ff63e327463823d741E84721B6D", //vDODO DODOCirculationHelper: "", diff --git a/contracts/external/Multicall.sol b/contracts/external/Multicall.sol new file mode 100644 index 0000000..bb3431f --- /dev/null +++ b/contracts/external/Multicall.sol @@ -0,0 +1,49 @@ +/** + *Submitted for verification at Etherscan.io on 2019-06-10 +*/ + +pragma solidity 0.6.9; +pragma experimental ABIEncoderV2; + +/// @title Multicall - Aggregate results from multiple read-only function calls +/// @author Michael Elliot +/// @author Joshua Levine +/// @author Nick Johnson + +contract Multicall { + struct Call { + address target; + bytes callData; + } + function aggregate(Call[] memory calls) public returns (uint256 blockNumber, bytes[] memory returnData) { + blockNumber = block.number; + returnData = new bytes[](calls.length); + for(uint256 i = 0; i < calls.length; i++) { + (bool success, bytes memory ret) = calls[i].target.call(calls[i].callData); + require(success); + returnData[i] = ret; + } + } + // Helper functions + function getEthBalance(address addr) public view returns (uint256 balance) { + balance = addr.balance; + } + function getBlockHash(uint256 blockNumber) public view returns (bytes32 blockHash) { + blockHash = blockhash(blockNumber); + } + function getLastBlockHash() public view returns (bytes32 blockHash) { + blockHash = blockhash(block.number - 1); + } + function getCurrentBlockTimestamp() public view returns (uint256 timestamp) { + timestamp = block.timestamp; + } + function getCurrentBlockDifficulty() public view returns (uint256 difficulty) { + difficulty = block.difficulty; + } + function getCurrentBlockGasLimit() public view returns (uint256 gaslimit) { + gaslimit = block.gaslimit; + } + function getCurrentBlockCoinbase() public view returns (address coinbase) { + coinbase = block.coinbase; + } +} \ No newline at end of file diff --git a/deploy-detail-periphery.txt b/deploy-detail-periphery.txt index 181e59d..597a092 100644 --- a/deploy-detail-periphery.txt +++ b/deploy-detail-periphery.txt @@ -276,3 +276,19 @@ Deploy time: 2021/3/15 下午8:00:28 Deploy type: UpCrowdPoolingFactory UpCrowdPoolingFactory address: 0x25AE560522165eacCFbF2287493AF12B8ad718e7 Init UpCpFactory Tx: 0x9692b9458c3f3f4c1682f58cc46c14c662e5b7b7f72c7b8afabc494d2eb75d16 +==================================================== +network type: mbtestnet +Deploy time: 2021/3/15 下午9:01:02 +Deploy type: DODOToken +DODOTokenAddress: 0x5c4242beB94dE30b922f57241f1D02f36e906915 +==================================================== +network type: mbtestnet +Deploy time: 2021/3/15 下午9:02:37 +Deploy type: DODOToken +DODOTokenAddress: 0x42e2EE7Ba8975c473157634Ac2AF4098190fc741 +==================================================== +network type: mbtestnet +Deploy time: 2021/3/15 下午9:02:47 +Deploy type: WETH9 +WETH9Address: 0xF8cef78E923919054037a1D03662bBD884fF4edf +MultiCallAddress: 0xb61c30c1612504d334b39E5172D8215cb5Ad576C diff --git a/deploy-detail-v2.0.txt b/deploy-detail-v2.0.txt index bf433cb..11ad83d 100644 --- a/deploy-detail-v2.0.txt +++ b/deploy-detail-v2.0.txt @@ -612,3 +612,46 @@ Deploy type: V2 multiSigAddress: 0x95C4F5b83aA70810D4f142d58e5F7242Bd891CB0 DODOV2Proxy02 Address: 0x9F8B87ee9D1b596e7479502de5B4f295E437C8d9 Init DODOProxyV2 Tx: 0x4b6086c0b79edac7a55fedd00fd6104fae133569afa05484d0608d0b96844979 +==================================================== +network type: mbtestnet +Deploy time: 2021/3/15 下午9:03:45 +Deploy type: V2 +multiSigAddress: 0x6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b +DODOSellHelper Address: 0xe573BCA813c741229ffB2488F7856C6cAa841041 +DODOCalleeHelperAddress: 0xBb0CC0fb3e0c06725c67167501f850B4900D6DB5 +DODOV1RouterHelper Address: 0xfE5D3c52F7ee9aa32a69b96Bfbb088Ba0bCd8EfC +CloneFactoryAddress: 0x92496871560a01551E1B4fD04540D7A519D5C19e +DefaultMtFeeRateAddress: 0x63A1519eE99d1121780FFfa1726Ed2eCc6d1611B +Init DefaultMtFeeRateAddress Tx: 0x1c1d4a1190b30fe3070ef936bcbc6029d7db7e85d47b3f01bd913da38adbdf8d +DefaultPermissionAddress: 0x50275d3F95E0F2FCb2cAb2Ec7A231aE188d7319d +Init DefaultPermissionAddress Tx: 0x3472a0da5656f0f18260517a4e8d022aec31ac072502419b438ad61f3e4704f4 +DvmTemplateAddress: 0x596fB37d99bd679d1af76fBCB658f7a1a31A1205 +DppTemplateAddress: 0x4d6942683D051FF95804B08EF11F98A7F41C1b44 +DppAdminTemplateAddress: 0x79885EBC79783C9174faC36Ed99cD9467CB8cDbE +CpTemplateAddress: 0xe9CC152481642D7a3Ea207E3930067B19663770F +ERC20TemplateAddress: 0x0484C33Bad127FA77CC64d6475aDD6483c70BbB9 +MintableERC20TemplateAddress: 0x4FBb399fB0E360e11DFF274090650C7e588F1af1 +ERC20FactoryAddress: 0xC7430D8919b54F85a723810FBceF2114482EC5D1 +DODOApprove Address: 0xC683516e791c5E2b8e913dE0670d499927f54CEc +DODOApproveProxy Address: 0x1bc238EAd60bdF5e94BB8f7205b6e75ACabACbC0 +DODOIncentiveAddress: 0xc5A6D29ed21e63A994A766558cDb055832dbF886 +DODOIncentive Init tx: 0x93267e8c636859eef852e88b48611e2fdd0739d7f4b51468b7a2b852ff473401 +DvmFactoryAddress: 0xFa39bFe0f589aba7315090bDaEbDF617535B130f +Init DvmFactory Tx: 0x453b758492556a2a7ab7d3db10c5e3787b64a5e544d2ba526d322ab0ac664d24 +DppFactoryAddress: 0x708bE4dA5e8D8E40dC51A1Dc5987Cc2a7fB22334 +Init DppFactory Tx: 0xd343a9163a57abfa704287a40141b95fdf7442ab789901ff496fc09503a3927e +CpFactoryAddress: 0xE18691ddF53F52705CBD518dF4c2632adDD8a9e5 +Init CpFactory Tx: 0xe7b5ba791a9ac41c24c22f27bb1791ca68e72a03d7ffe43403b63f6035042d81 +DODOV2RouteHelper Address: 0x750C200d7c7C426da169742f705CA5268e1736b4 +DODOV2Proxy02 Address: 0x58eD6D2faa3C8Ff63e327463823d741E84721B6D +Init DODOProxyV2 Tx: 0x02f3d607219bb702e20d394a66a1b62f747423c355ad20fb2f27fd3279647d8e +DODOApproveProxy Init tx: 0x9b688063eff15620a1e008e65462d6bb3304d64c5bb35c16cea8583665541c0e +DODOApprove Init tx: 0x9a47d0fb5cddad371fd8b46d32073872d533716fff8375c15faf5c04dc8bb58c +DODOIncentive ChangeProxy tx: 0xe7054541b46dc3a6d7f81c5d699221bf866c60a2ce92bd6f5ee3f5651bf222cf +==================================================== +network type: mbtestnet +Deploy time: 2021/3/15 下午9:21:03 +Deploy type: V2 - Adapter +DODOV1Adapter Address: 0x1a3fa978909d86dF1244216b02733136b438D83E +DODOV2Adapter Address: 0x0e1630bd2bc047fF6338F78Dc45410e1c0Fc32a0 +UniAdapter Address: 0x1E7727eDad5a2ef47C5AB95a20FEd515735591B2 diff --git a/migrations/4_deploy_periphery.js b/migrations/4_deploy_periphery.js index 20ef0bc..48c5fd6 100644 --- a/migrations/4_deploy_periphery.js +++ b/migrations/4_deploy_periphery.js @@ -15,6 +15,7 @@ const WETH9 = artifacts.require("WETH9"); const DODOToken = artifacts.require("DODOToken"); const UpCrowdPoolingFactory = artifacts.require("UpCrowdPoolingFactory"); const CpFactory = artifacts.require("CrowdPoolingFactory"); +const MultiCall = artifacts.require("Multicall"); module.exports = async (deployer, network, accounts) => { let CONFIG = GetConfig(network, accounts) @@ -58,6 +59,12 @@ module.exports = async (deployer, network, accounts) => { logger.log("Init UpCpFactory Tx:", tx.tx); } + if (deploySwitch.MultiCall) { + await deployer.deploy(MultiCall); + MultiCallAddress = MultiCall.address; + logger.log("MultiCallAddress: ", MultiCallAddress); + } + if (deploySwitch.CPFactory) { logger.log("===================================================="); logger.log("network type: " + network); @@ -78,7 +85,7 @@ module.exports = async (deployer, network, accounts) => { logger.log("Init CpFactory Tx:", tx.tx); } - if(deploySwitch.DVM) { + if (deploySwitch.DVM) { await deployer.deploy(DvmTemplate); DvmTemplateAddress = DvmTemplate.address; logger.log("DvmTemplateAddress: ", DvmTemplateAddress); diff --git a/truffle-config.js b/truffle-config.js index c5421e5..febd37b 100644 --- a/truffle-config.js +++ b/truffle-config.js @@ -52,7 +52,8 @@ module.exports = { UpCP: false, DVM: false, CP: false, - CPFactory: false + CPFactory: false, + MultiCall: true }, networks: { @@ -112,9 +113,9 @@ module.exports = { mbtestnet: { provider: () => { - return new HDWalletProvider(privKey, 'https://rpc.testnet.moonbeam.network'); + return new HDWalletProvider(privKey, 'https://moonbeam-rpc.dodoex.io'); }, - network_id: 1287, + network_id: 1281, }, mbdev: {