fix idvm interface

This commit is contained in:
owen05
2021-03-14 16:49:33 +08:00
parent 6b1864866a
commit 4ef8fd9cad
13 changed files with 54 additions and 9 deletions

View File

@@ -15,7 +15,7 @@ module.exports = {
CloneFactory: "0x03E2427859119E497EB856a166F616a2Ce5f8c88",
FeeRateModel: "0x18DFdE99F578A0735410797e949E8D3e2AFCB9D2",
PermissionManager: "0x729f7f44bf64Ce814716b6261e267DbE6cdf021c",
DVM: "0x02607600407329389C2912F46DD357d7fa33d901",
DVM: "0xe44F14BFDe673B7339734a28152cCd6b821753C9",
DPP: "0x85351262f7474Ebe23FfAcD633cf20A491F1325D",
DPPAdmin: "0x44D5dF24d5Ef52A791D6436Fa45A8D426f6de34e",
CP: "0x041ABa00c57Dd47abC37A2931dF569a2A2cc57Be",

View File

@@ -15,7 +15,7 @@ module.exports = {
CloneFactory: "0x5e5a7b76462e4bdf83aa98795644281bdba80b88",
FeeRateModel: "0x5e84190a270333aCe5B9202a3F4ceBf11b81bB01",
PermissionManager: "0x6B208E08dcF6BD51F50C5Da09d15B2D8E5C46Cf2",
DVM: "0x8a538751A501A9785F93727d4cB7b7827FAb1ad0",
DVM: "",
DPP: "0xB76de21f04F677f07D9881174a1D8E624276314C",
DPPAdmin: "0x5515363c0412AdD5c72d3E302fE1bD7dCBCF93Fe",
CP: "0x18b0bD918b55f995Fd404B872404378A62cb403b",

View File

@@ -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_);

View File

@@ -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";
}
}

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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];
}
}

View File

@@ -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

View File

@@ -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);

View File

@@ -86,7 +86,7 @@ async function initIncentive(ctx: ProxyContext, delay: number): Promise<void> {
await ctx.LockedVault02.methods.updateParams(
Math.floor(new Date().getTime() / 1000 + delay),
60 * 60 * 24 * 30,
300000000000000000
"300000000000000000"
).send(ctx.sendParam(ctx.Deployer));
}

View File

@@ -148,7 +148,7 @@ export class ProxyContext {
this.DODO.options.address,
Math.floor(new Date().getTime() / 1000),
60 * 60 * 24 * 30,
300000000000000000
"300000000000000000"
]
)

View File

@@ -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
},

View File

@@ -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