diff --git a/config/bsc-config.js b/config/bsc-config.js index d59460d..d172b65 100644 --- a/config/bsc-config.js +++ b/config/bsc-config.js @@ -15,7 +15,7 @@ module.exports = { CloneFactory: "0x03E2427859119E497EB856a166F616a2Ce5f8c88", FeeRateModel: "0x18DFdE99F578A0735410797e949E8D3e2AFCB9D2", PermissionManager: "0x729f7f44bf64Ce814716b6261e267DbE6cdf021c", - DVM: "0x02607600407329389C2912F46DD357d7fa33d901", + DVM: "0xe44F14BFDe673B7339734a28152cCd6b821753C9", DPP: "0x85351262f7474Ebe23FfAcD633cf20A491F1325D", DPPAdmin: "0x44D5dF24d5Ef52A791D6436Fa45A8D426f6de34e", CP: "0x041ABa00c57Dd47abC37A2931dF569a2A2cc57Be", diff --git a/config/eth-config.js b/config/eth-config.js index aa7b89c..4b614a4 100644 --- a/config/eth-config.js +++ b/config/eth-config.js @@ -15,7 +15,7 @@ module.exports = { CloneFactory: "0x5e5a7b76462e4bdf83aa98795644281bdba80b88", FeeRateModel: "0x5e84190a270333aCe5B9202a3F4ceBf11b81bB01", PermissionManager: "0x6B208E08dcF6BD51F50C5Da09d15B2D8E5C46Cf2", - DVM: "0x8a538751A501A9785F93727d4cB7b7827FAb1ad0", + DVM: "", DPP: "0xB76de21f04F677f07D9881174a1D8E624276314C", DPPAdmin: "0x5515363c0412AdD5c72d3E302fE1bD7dCBCF93Fe", CP: "0x18b0bD918b55f995Fd404B872404378A62cb403b", diff --git a/contracts/CrowdPooling/impl/CPFunding.sol b/contracts/CrowdPooling/impl/CPFunding.sol index e1aed06..f6cc7d3 100644 --- a/contracts/CrowdPooling/impl/CPFunding.sol +++ b/contracts/CrowdPooling/impl/CPFunding.sol @@ -101,7 +101,7 @@ contract CPFunding is CPStorage { _transferBaseOut(_POOL_, poolBase); _transferQuoteOut(_POOL_, poolQuote); - _TOTAL_LP_AMOUNT_ = IDVM(_POOL_).buyShares(address(this)); + (_TOTAL_LP_AMOUNT_, ,) = IDVM(_POOL_).buyShares(address(this)); msg.sender.transfer(_SETTEL_FUND_); diff --git a/contracts/DODOVendingMachine/impl/DVM.sol b/contracts/DODOVendingMachine/impl/DVM.sol index 0673063..2dc9d8b 100644 --- a/contracts/DODOVendingMachine/impl/DVM.sol +++ b/contracts/DODOVendingMachine/impl/DVM.sol @@ -91,6 +91,6 @@ contract DVM is DVMTrader, DVMFunding { // ============ Version Control ============ function version() external pure returns (string memory) { - return "DVM 1.0.1"; + return "DVM 1.0.2"; } } diff --git a/contracts/DODOVendingMachine/impl/DVMVault.sol b/contracts/DODOVendingMachine/impl/DVMVault.sol index a57e1c2..fe125b0 100644 --- a/contracts/DODOVendingMachine/impl/DVMVault.sol +++ b/contracts/DODOVendingMachine/impl/DVMVault.sol @@ -180,6 +180,7 @@ contract DVMVault is DVMStorage { } function _mint(address user, uint256 value) internal { + require(value > 0, "MINT_INVALID"); _SHARES_[user] = _SHARES_[user].add(value); totalSupply = totalSupply.add(value); emit Mint(user, value); diff --git a/contracts/DODOVendingMachine/intf/IDVM.sol b/contracts/DODOVendingMachine/intf/IDVM.sol index 9b20488..dc0f079 100644 --- a/contracts/DODOVendingMachine/intf/IDVM.sol +++ b/contracts/DODOVendingMachine/intf/IDVM.sol @@ -32,6 +32,6 @@ interface IDVM { function sellQuote(address to) external returns (uint256); - function buyShares(address to) external returns (uint256); + function buyShares(address to) external returns (uint256,uint256,uint256); } diff --git a/contracts/Factory/ERC20Factory.sol b/contracts/Factory/ERC20Factory.sol index cf6a0ab..60a2fe9 100644 --- a/contracts/Factory/ERC20Factory.sol +++ b/contracts/Factory/ERC20Factory.sol @@ -30,6 +30,10 @@ contract ERC20Factory { event NewERC20(address erc20, address creator, bool isMintable); + // ============ Registry ============ + // creator -> token address list + mapping(address => address[]) public _USER_STD_REGISTRY_; + // ============ Functions ============ constructor( @@ -50,6 +54,7 @@ contract ERC20Factory { ) external returns (address newERC20) { newERC20 = ICloneFactory(_CLONE_FACTORY_).clone(_ERC20_TEMPLATE_); InitializableERC20(newERC20).init(msg.sender, totalSupply, name, symbol, decimals); + _USER_STD_REGISTRY_[msg.sender].push(newERC20); emit NewERC20(newERC20, msg.sender, false); } @@ -69,4 +74,13 @@ contract ERC20Factory { ); emit NewERC20(newMintableERC20, msg.sender, true); } + + + function getTokenByUser(address user) + external + view + returns (address[] memory tokens) + { + return _USER_STD_REGISTRY_[user]; + } } diff --git a/deploy-detail-periphery.txt b/deploy-detail-periphery.txt index f1b0d8e..3b30295 100644 --- a/deploy-detail-periphery.txt +++ b/deploy-detail-periphery.txt @@ -214,3 +214,11 @@ Deploy time: 2021/3/13 下午11:43:58 Deploy type: UpCrowdPoolingFactory UpCrowdPoolingFactory address: 0x0c4b4F1D5F5c989457cdD6f5102308b33c922281 Init UpCpFactory Tx: 0xd03546fa116a1eff47d729bc86e5b56143522fc846f0413f6b0b7dda1dd37a04 +==================================================== +network type: development +Deploy time: 2021/3/14 下午12:01:16 +Deploy type: UpCrowdPoolingFactory +DvmTemplateAddress: 0xe44F14BFDe673B7339734a28152cCd6b821753C9 +DvmTemplateAddress: 0x01FEEA29da5Ae41B0b5F6b10b93EE34752eF80d7 +CpTemplateAddress: 0x5D6e6A0BFB2176AFCc4FB809822D8e009216b245 +CpTemplateAddress: 0x327344B382EE1b44FB0a72945fCDCC7243200dD7 diff --git a/migrations/4_deploy_periphery.js b/migrations/4_deploy_periphery.js index 01ce19b..9acbc0b 100644 --- a/migrations/4_deploy_periphery.js +++ b/migrations/4_deploy_periphery.js @@ -5,6 +5,8 @@ let logger = new console.Console(file, file); const { GetConfig } = require("../configAdapter.js") const DODORecharge = artifacts.require("DODORecharge"); +const DvmTemplate = artifacts.require("DVM"); +const CpTemplate = artifacts.require("CP"); const vDODOToken = artifacts.require("vDODOToken"); const DODOCirculationHelper = artifacts.require("DODOCirculationHelper"); const DODOMine = artifacts.require("DODOMine"); @@ -30,6 +32,7 @@ module.exports = async (deployer, network, accounts) => { let DefaultPermissionAddress = CONFIG.PermissionManager; let CpTemplateAddress = CONFIG.CP; let DvmFactoryAddress = CONFIG.DVMFactory; + let DvmTemplateAddress = CONFIG.DVM; let multiSigAddress = CONFIG.multiSigAddress; let defaultMaintainer = CONFIG.defaultMaintainer; @@ -54,6 +57,18 @@ module.exports = async (deployer, network, accounts) => { logger.log("Init UpCpFactory Tx:", tx.tx); } + if(deploySwitch.DVM) { + await deployer.deploy(DvmTemplate); + DvmTemplateAddress = DvmTemplate.address; + logger.log("DvmTemplateAddress: ", DvmTemplateAddress); + } + + if (deploySwitch.CP) { + await deployer.deploy(CpTemplate); + CpTemplateAddress = CpTemplate.address; + logger.log("CpTemplateAddress: ", CpTemplateAddress); + } + if (deploySwitch.FEERATEIMPL) { logger.log("===================================================="); logger.log("network type: " + network); diff --git a/test/V2Proxy/proxy.incentive.bsc.test.ts b/test/V2Proxy/proxy.incentive.bsc.test.ts index 7cf2e80..c416231 100644 --- a/test/V2Proxy/proxy.incentive.bsc.test.ts +++ b/test/V2Proxy/proxy.incentive.bsc.test.ts @@ -86,7 +86,7 @@ async function initIncentive(ctx: ProxyContext, delay: number): Promise { await ctx.LockedVault02.methods.updateParams( Math.floor(new Date().getTime() / 1000 + delay), 60 * 60 * 24 * 30, - 300000000000000000 + "300000000000000000" ).send(ctx.sendParam(ctx.Deployer)); } diff --git a/test/utils/ProxyContextV2.ts b/test/utils/ProxyContextV2.ts index a422a74..9a624f7 100644 --- a/test/utils/ProxyContextV2.ts +++ b/test/utils/ProxyContextV2.ts @@ -148,7 +148,7 @@ export class ProxyContext { this.DODO.options.address, Math.floor(new Date().getTime() / 1000), 60 * 60 * 24 * 30, - 300000000000000000 + "300000000000000000" ] ) diff --git a/truffle-config.js b/truffle-config.js index 590b04f..eb7d0bd 100644 --- a/truffle-config.js +++ b/truffle-config.js @@ -49,7 +49,9 @@ module.exports = { FEERATEIMPL: false, WETH: false, DODO: false, - UpCP: true + UpCP: false, + DVM: false, + CP: false }, networks: { @@ -84,7 +86,7 @@ module.exports = { return new HDWalletProvider(privKey, "https://mainnet.infura.io/v3/" + infuraId); }, gas: 6000000, - gasPrice: 180000000000, + gasPrice: 130000000000, network_id: 1, skipDryRun: true }, diff --git a/truffle-test.sh b/truffle-test.sh index af92cd8..a5ad56a 100644 --- a/truffle-test.sh +++ b/truffle-test.sh @@ -31,6 +31,11 @@ then truffle test ./test/V2Proxy/proxy.incentive.test.ts fi +if [ "$1"x = "proxy-incentive-bsc"x ] +then + truffle test ./test/V2Proxy/proxy.incentive.bsc.test.ts +fi + if [ "$1"x = "proxy-twap"x ] then truffle test ./test/V2Proxy/proxy.twap.test.ts