add deploy script && update vdodo

This commit is contained in:
owen05
2021-02-04 17:21:18 +08:00
parent 4ebe28fb06
commit 7287fde9b3
9 changed files with 160 additions and 33 deletions

View File

@@ -72,7 +72,7 @@ contract DODOBscToken is InitializableOwnable {
return allowed[owner][spender]; return allowed[owner][spender];
} }
function redeem(uint256 amount, uint256 value, address redeemToEthAccount) external { function redeem(uint256 value, address redeemToEthAccount) external {
require(balances[msg.sender] >= value, "DODOBscToken: NOT_ENOUGH"); require(balances[msg.sender] >= value, "DODOBscToken: NOT_ENOUGH");
balances[msg.sender] = balances[msg.sender].sub(value); balances[msg.sender] = balances[msg.sender].sub(value);
totalSupply = totalSupply.sub(value); totalSupply = totalSupply.sub(value);

View File

@@ -30,9 +30,9 @@ contract vDODOToken is InitializableOwnable {
// ============ Storage(ERC20) ============ // ============ Storage(ERC20) ============
string public name; string public name = "vDODO Token";
string public symbol; string public symbol = "vDODO";
uint8 public decimals; uint8 public decimals = 18;
uint256 public totalSupply; uint256 public totalSupply;
mapping(address => mapping(address => uint256)) internal _ALLOWED_; mapping(address => mapping(address => uint256)) internal _ALLOWED_;
@@ -91,18 +91,11 @@ contract vDODOToken is InitializableOwnable {
constructor( constructor(
address dodoGov, address dodoGov,
address dodoToken, address dodoToken,
address dodoCirculationHelper, address dodoApproveProxy
address dodoApproveProxy,
string memory _name,
string memory _symbol
) public { ) public {
name = _name;
symbol = _symbol;
decimals = 18;
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
_DOOD_GOV_ = dodoGov; _DOOD_GOV_ = dodoGov;
_DODO_CIRCULATION_HELPER_ = dodoCirculationHelper;
_DODO_TOKEN_ = dodoToken; _DODO_TOKEN_ = dodoToken;
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
lastRewardBlock = uint128(block.number); lastRewardBlock = uint128(block.number);
} }
@@ -216,8 +209,12 @@ contract vDODOToken is InitializableOwnable {
} }
function availableBalanceOf(address account) public view returns (uint256 balance) { function availableBalanceOf(address account) public view returns (uint256 balance) {
uint256 lockedBalance = IGovernance(_DOOD_GOV_).getLockedvDODO(account); if(_DOOD_GOV_ == address(0)){
balance = balanceOf(account).sub(lockedBalance); balance = balanceOf(account);
}else {
uint256 lockedBalance = IGovernance(_DOOD_GOV_).getLockedvDODO(account);
balance = balanceOf(account).sub(lockedBalance);
}
} }
function transfer(address to, uint256 amount) public returns (bool) { function transfer(address to, uint256 amount) public returns (bool) {

View File

@@ -0,0 +1,6 @@
====================================================
network type: bsclive
Deploy time: 2021/2/4 下午4:56:38
Deploy type: DODOBscToken
DODOBscTokenAddress: 0x67ee3Cb086F8a16f34beE3ca72FAD36F7Db929e2
Init DODOBscTokenAddress Tx: 0xf66264c2669f904527de63fab104250275247c014bfb6f42f57441997551cef6

View File

@@ -572,3 +572,11 @@ Init DODOProxyV2 Tx: 0xb41219ef20f0496c8c2088bf8d30a64dd3fa1ef5cdaeaa9161a6da523
DODOApproveProxy Init tx: 0x38ced5f643938891ad553b40bafe55ffc6065a15e4bbc81f4cdfbe4f3a0b9494 DODOApproveProxy Init tx: 0x38ced5f643938891ad553b40bafe55ffc6065a15e4bbc81f4cdfbe4f3a0b9494
DODOApprove Init tx: 0x7eac3f1fa6dbe499351ea52066623980615bdc7901a84f2afa8fc67e34e4be59 DODOApprove Init tx: 0x7eac3f1fa6dbe499351ea52066623980615bdc7901a84f2afa8fc67e34e4be59
DODOIncentive ChangeProxy tx: 0x6d64bae7ee09f12db0bfc18823ac8e2ca1d682184c1ed3cc157f2b39641409e3 DODOIncentive ChangeProxy tx: 0x6d64bae7ee09f12db0bfc18823ac8e2ca1d682184c1ed3cc157f2b39641409e3
====================================================
network type: bsclive
Deploy time: 2021/2/4 下午5:09:20
DODOCalleeHelperAddress: 0xaaffAd1017D6a13E026A00121BF258C616B25f7C
====================================================
network type: kovan
Deploy time: 2021/2/4 下午5:16:38
DODOCalleeHelperAddress: 0x36ce1831941d35c3588759B2D084E240a094ad4A

View File

@@ -442,3 +442,6 @@ Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x43688f367eb83697c3ca5d0
Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Pool:0x1D690066fc3F2D808555839B630a89da118B9466 Tx: 0x5e3609531f6a6918bcc2f9d91b154d78f0b15d8b229da00cda960a380fd909dd Create DPP: 0xd8C30a4E866B188F16aD266dC3333BD47F34ebaE-0x156595bAF85D5C29E91d959889B022d952190A64 Pool:0x1D690066fc3F2D808555839B630a89da118B9466 Tx: 0x5e3609531f6a6918bcc2f9d91b154d78f0b15d8b229da00cda960a380fd909dd
Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x43688f367eb83697c3ca5d03c5055b6bd6f6ac4b Pool:0x7B0d1D528a08619B370eb5c920298F74465b1982 Tx: 0x1dffacc99a0ce542425eb5fd977da570dae26246abb929e2a4eb04fcdee6a994 Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x43688f367eb83697c3ca5d03c5055b6bd6f6ac4b Pool:0x7B0d1D528a08619B370eb5c920298F74465b1982 Tx: 0x1dffacc99a0ce542425eb5fd977da570dae26246abb929e2a4eb04fcdee6a994
Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Pool:0x3997576b46e26D3fCEa7C4A76a62146AE5A903F3 Tx: 0x07dc666596b9c47522ed8dfb194cfcc9d673c0c63ec4d456d7b7485ea7eca57b Create DPP: 0xd7f02D1b4F9495B549787808503Ecfd231C3fbDA-0x156595bAF85D5C29E91d959889B022d952190A64 Pool:0x3997576b46e26D3fCEa7C4A76a62146AE5A903F3 Tx: 0x07dc666596b9c47522ed8dfb194cfcc9d673c0c63ec4d456d7b7485ea7eca57b
====================================================
network type: kovan
Deploy time: 2021/2/4 下午5:17:14

View File

@@ -164,6 +164,11 @@ module.exports = async (deployer, network, accounts) => {
logger.log("network type: " + network); logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString()); logger.log("Deploy time: " + new Date().toLocaleString());
if (deploySwitch.CALLEE) {
await deployer.deploy(DODOCalleeHelper, WETHAddress);
DODOCalleeHelperAddress = DODOCalleeHelper.address;
logger.log("DODOCalleeHelperAddress: ", DODOCalleeHelperAddress);
}
if (deploySwitch.ADAPTER) { if (deploySwitch.ADAPTER) {
logger.log("Deploy type: V2 - Adapter"); logger.log("Deploy type: V2 - Adapter");
@@ -232,6 +237,9 @@ module.exports = async (deployer, network, accounts) => {
await deployer.deploy(FeeRateModelTemplate); await deployer.deploy(FeeRateModelTemplate);
DefaultMtFeeRateAddress = FeeRateModelTemplate.address; DefaultMtFeeRateAddress = FeeRateModelTemplate.address;
logger.log("DefaultMtFeeRateAddress: ", DefaultMtFeeRateAddress); logger.log("DefaultMtFeeRateAddress: ", DefaultMtFeeRateAddress);
const defaultMtFeeRateInstance = await FeeRateModelTemplate.at(DefaultMtFeeRateAddress);
var tx = await defaultMtFeeRateInstance.initOwner(multiSigAddress);
logger.log("Init DefaultMtFeeRateAddress Tx:", tx.tx);
} }
if (DefaultPermissionAddress == "") { if (DefaultPermissionAddress == "") {

View File

@@ -0,0 +1,103 @@
const fs = require("fs");
const { deploySwitch } = require('../truffle-config.js')
const file = fs.createWriteStream("../deploy-detail-periphery.txt", { 'flags': 'a' });
let logger = new console.Console(file, file);
const DODOBscToken = artifacts.require("DODOBscToken");
const DODOMigrationBSC = artifacts.require("DODOMigrationBSC");
const vDODOToken = artifacts.require("vDODOToken");
const DODOCirculationHelper = artifacts.require("DODOCirculationHelper");
module.exports = async (deployer, network, accounts) => {
let DODOTokenAddress = "";
let DODOApproveProxyAddress = "";
let DODOCirculationHelperAddress = "";
let GovernanceAddress = "";
let vDODOTokenAddress = "";
if (network == "kovan") {
DODOTokenAddress = "0xfF2985D13953Cb92ecc585aA2B6A4AF8cB46068f";
DODOApproveProxyAddress = "";
DODOCirculationHelperAddress = "";
vDODOTokenAddress = "";
GovernanceAddress = "0x0000000000000000000000000000000000000000";
//Account
multiSigAddress = accounts[0];
} else if (network == "live") {
DODOTokenAddress = "0x43dfc4159d86f3a37a5a4b3d4580b888ad7d4ddd";
DODOApproveProxyAddress = " 0x335aC99bb3E51BDbF22025f092Ebc1Cf2c5cC619";
DODOCirculationHelperAddress = "";
vDODOTokenAddress = "";
GovernanceAddress = "0x0000000000000000000000000000000000000000";
//Account
multiSigAddress = "0x95C4F5b83aA70810D4f142d58e5F7242Bd891CB0";
} else if (network == "bsclive") {
//Account
multiSigAddress = "0x4073f2b9bB95774531b9e23d206a308c614A943a";
} else return;
logger.log("====================================================");
logger.log("network type: " + network);
logger.log("Deploy time: " + new Date().toLocaleString());
if (deploySwitch.DODOBscToken && (network == "bsclive")) {
logger.log("Deploy type: DODOBscToken");
await deployer.deploy(DODOBscToken);
DODOBscTokenAddress = DODOBscToken.address;
logger.log("DODOBscTokenAddress: ", DODOBscTokenAddress);
const dodoBscTokenInstance = await DODOBscToken.at(DODOBscTokenAddress);
var tx = await dodoBscTokenInstance.initOwner("0x9c59990ec0177d87ED7D60A56F584E6b06C639a2");
logger.log("Init DODOBscTokenAddress Tx:", tx.tx);
}
if (deploySwitch.BSCMigration && (network !== "bsclive")) {
logger.log("Deploy type: DODOMigrationBSC");
await deployer.deploy(DODOMigrationBSC, DODOTokenAddress, DODOApproveProxyAddress);
DODOMigrationBSCAddress = DODOMigrationBSC.address;
logger.log("DODOMigrationBSCAddress: ", DODOMigrationBSCAddress);
const dodoMigrationBscInstance = await DODOMigrationBSC.at(DODOMigrationBSCAddress);
var tx = await dodoMigrationBscInstance.initOwner(multiSigAddress);
logger.log("Init DODOMigrationBSCAddress Tx:", tx.tx);
}
if (deploySwitch.vDODOToken) {
logger.log("Deploy type: vDODOToken");
if (vDODOTokenAddress == "") {
await deployer.deploy(
vDODOToken,
GovernanceAddress,
DODOTokenAddress,
DODOApproveProxyAddress
);
vDODOTokenAddress = vDODOToken.address;
logger.log("vDODOTokenAddress: ", vDODOTokenAddress);
const vDODOTokenInstance = await vDODOToken.at(vDODOTokenAddress);
var tx = await vDODOTokenInstance.initOwner(multiSigAddress);
logger.log("Init vDODOTokenAddress Tx:", tx.tx);
}
if (DODOCirculationHelperAddress == "") {
await deployer.deploy(DODOCirculationHelper, vDODOTokenAddress, DODOTokenAddress );
DODOCirculationHelperAddress = DODOCirculationHelper.address;
logger.log("DODOCirculationHelperAddress: ", DODOCirculationHelperAddress);
const DODOCirculationHelperInstance = await DODOCirculationHelper.at(DODOCirculationHelperAddress);
var tx = await DODOCirculationHelperInstance.initOwner(multiSigAddress);
logger.log("Init DODOCirculationHelperAddress Tx:", tx.tx);
}
if(network == 'kovan') {
const vDODOTokenInstance = await vDODOToken.at(vDODOTokenAddress);
//changePerReward
var tx = await vDODOTokenInstance.changePerReward("10000000000000000000");
logger.log("vDODOToken changeReward tx: ", tx.tx);
//updateDODOCirculationHelper
tx = await vDODOTokenInstance.updateDODOCirculationHelper(DODOCirculationHelperAddress);
logger.log("vDODOToken setDODOCirculationHelper tx: ", tx.tx);
}
}
};

View File

@@ -34,7 +34,7 @@ export class VDODOContext {
DODOApproveProxy: Contract; DODOApproveProxy: Contract;
DODOCirculationHelper: Contract; DODOCirculationHelper: Contract;
Governance: Contract; // Governance: Contract;
lastRewardBlock: number; lastRewardBlock: number;
alpha: number; alpha: number;
@@ -66,21 +66,19 @@ export class VDODOContext {
[this.DODOApprove.options.address] [this.DODOApprove.options.address]
) )
this.Governance = await contracts.newContract( // this.Governance = await contracts.newContract(
contracts.DODO_GOVERNANCE, // contracts.DODO_GOVERNANCE,
[ // [
this.DODO.options.address // this.DODO.options.address
] // ]
) // )
this.VDODO = await contracts.newContract( this.VDODO = await contracts.newContract(
contracts.VDODO_NAME, contracts.VDODO_NAME,
[ [
this.Governance.options.address,
this.DODO.options.address,
"0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000",
this.DODOApproveProxy.options.address, this.DODO.options.address,
"VDODO Token", "VDODO" this.DODOApproveProxy.options.address
] ]
) )
@@ -92,13 +90,13 @@ export class VDODOContext {
] ]
); );
await this.Governance.methods.initOwner( // await this.Governance.methods.initOwner(
this.Deployer // this.Deployer
).send(this.sendParam(this.Deployer)) // ).send(this.sendParam(this.Deployer))
await this.Governance.methods.setVDODOAddress( // await this.Governance.methods.setVDODOAddress(
this.VDODO.options.address // this.VDODO.options.address
).send(this.sendParam(this.Deployer)) // ).send(this.sendParam(this.Deployer))
await this.DODOApprove.methods.init(this.Deployer, this.DODOApproveProxy.options.address).send(this.sendParam(this.Deployer)); await this.DODOApprove.methods.init(this.Deployer, this.DODOApproveProxy.options.address).send(this.sendParam(this.Deployer));
await this.DODOApproveProxy.methods.init(this.Deployer, [this.VDODO.options.address]).send(this.sendParam(this.Deployer)); await this.DODOApproveProxy.methods.init(this.Deployer, [this.VDODO.options.address]).send(this.sendParam(this.Deployer));

View File

@@ -45,7 +45,11 @@ module.exports = {
MOCK_V2_POOL: false, MOCK_V2_POOL: false,
MOCK_V2_SWAP: false, MOCK_V2_SWAP: false,
MANUAL_ADD_POOL: false, MANUAL_ADD_POOL: false,
MOCK_TARGET_POOL: false MOCK_TARGET_POOL: false,
BSCMigration: false,
DODOBscToken: false,
vDODOToken: false,
CALLEE: true,
}, },
networks: { networks: {