bsc trade incentive

This commit is contained in:
owen05
2021-03-14 10:02:20 +08:00
parent 01c5447802
commit 6b1864866a
15 changed files with 1523 additions and 34 deletions

View File

@@ -35,7 +35,6 @@ export const DVM_PROXY_NAME = "DVMProxy"
export const CONST_FEE_RATE_MODEL_NAME = "ConstFeeRateModel"
export const PERMISSION_MANAGER_NAME = "PermissionManager"
export const EXTERNAL_VALUE_NAME = "ExternalValue"
export const DODO_PROXY_NAME = "DODOV2Proxy02"
export const FEE_RATE_MODEL_NAME = "FeeRateModel"
export const DPP_NAME = "DPP"
export const DPP_FACTORY_NAME = "DPPFactory"
@@ -47,9 +46,13 @@ export const DODO_CALLEE_HELPER_NAME = "DODOCalleeHelper"
export const CROWD_POOLING_NAME = "CP"
export const CROWD_POOLING_FACTORY = "CrowdPoolingFactory"
export const DODO_INCENTIVE = "DODOIncentive"
export const DODO_INCENTIVE_BSC = "DODOIncentiveBsc"
export const VDODO_NAME = "vDODOToken"
export const DODO_CULATION_HELPER = "DODOCirculationHelper"
export const DODO_GOVERNANCE = "Governance"
export const LOCKED_VAULT_02 = "LockedTokenVault02"
export const DODO_PROXY_NAME = "DODOV2Proxy02"
export const DODO_PROXY_NAME_BSC = "DODOV2Proxy03Bsc"
interface ContractJson {
abi: any;

View File

@@ -24,6 +24,7 @@ export class ProxyContext {
EVM: EVM;
Web3: Web3;
DODOProxyV2: Contract;
DODOProxyV2Bsc: Contract;
DVMFactory: Contract;
DPPFactory: Contract;
CPFactory: Contract;
@@ -40,6 +41,8 @@ export class ProxyContext {
//Functions
DODOIncentive: Contract;
DODOIncentiveBsc: Contract;
LockedVault02: Contract;
mtFeeRateModel: Contract;
Deployer: string;
@@ -48,7 +51,7 @@ export class ProxyContext {
constructor() { }
async init(weth:string) {
async init(weth: string) {
this.EVM = new EVM();
this.Web3 = getDefaultWeb3();
const allAccounts = await this.Web3.eth.getAccounts();
@@ -89,7 +92,7 @@ export class ProxyContext {
dvmTemplate.options.address,
this.Deployer,
mtFeeRateModelTemplate.options.address
]
]
)
this.DODOApprove = await contracts.newContract(
@@ -101,12 +104,18 @@ export class ProxyContext {
[this.DODOApprove.options.address]
)
//DODO Incentive
//DODO Incentive (ETH)
this.DODOIncentive = await contracts.newContract(
contracts.DODO_INCENTIVE,
[this.DODO.options.address]
)
//DODO Incentive (BSC)
this.DODOIncentiveBsc = await contracts.newContract(
contracts.DODO_INCENTIVE_BSC,
[this.DODO.options.address]
)
this.DPPFactory = await contracts.newContract(contracts.DPP_FACTORY_NAME,
[
cloneFactory.options.address,
@@ -126,14 +135,26 @@ export class ProxyContext {
this.Deployer,
mtFeeRateModelTemplate.options.address,
permissionManagerTemplate.options.address
]
]
)
this.DODOSellHelper = await contracts.newContract(
contracts.DODO_SELL_HELPER
);
//BSC 空投锁仓合约
this.LockedVault02 = await contracts.newContract(contracts.LOCKED_VAULT_02,
[
this.DODO.options.address,
Math.floor(new Date().getTime() / 1000),
60 * 60 * 24 * 30,
300000000000000000
]
)
await this.LockedVault02.methods.initOwner(this.Deployer).send(this.sendParam(this.Deployer));
//ETH proxy
this.DODOProxyV2 = await contracts.newContract(contracts.DODO_PROXY_NAME,
[
this.DVMFactory.options.address,
@@ -148,12 +169,36 @@ export class ProxyContext {
);
await this.DODOProxyV2.methods.initOwner(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.DODOApproveProxy.methods.init(this.Deployer, [this.DODOProxyV2.options.address]).send(this.sendParam(this.Deployer));
//BSC proxy
this.DODOProxyV2Bsc = await contracts.newContract(contracts.DODO_PROXY_NAME_BSC,
[
this.DVMFactory.options.address,
this.DPPFactory.options.address,
this.CPFactory.options.address,
this.WETH.options.address,
this.DODOApproveProxy.options.address,
this.DODOSellHelper.options.address,
"0x0000000000000000000000000000000000000000",
this.DODOIncentiveBsc.options.address
]
);
await this.DODOProxyV2Bsc.methods.initOwner(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.DODOApproveProxy.methods.init(this.Deployer, [this.DODOProxyV2.options.address, this.DODOProxyV2Bsc.options.address]).send(this.sendParam(this.Deployer));
//DODOIncentive ETH
await this.DODOIncentive.methods.initOwner(this.Deployer).send(this.sendParam(this.Deployer));
await this.DODOIncentive.methods.changeDODOProxy(this.DODOProxyV2.options.address).send(this.sendParam(this.Deployer));
//DODOIncentive BSC
await this.DODOIncentiveBsc.methods.initOwner(this.Deployer).send(this.sendParam(this.Deployer));
await this.DODOIncentiveBsc.methods.setContract(this.DODOProxyV2Bsc.options.address, this.LockedVault02.options.address).send(this.sendParam(this.Deployer));
await this.DODOIncentiveBsc.methods.setStableList(this.USDC.options.address, true).send(this.sendParam(this.Deployer));
await this.DODOIncentiveBsc.methods.setTokenList(this.DODO.options.address, true).send(this.sendParam(this.Deployer));
this.DODOCalleeHelper = await contracts.newContract(
contracts.DODO_CALLEE_HELPER_NAME,
[this.WETH.options.address]
@@ -191,7 +236,7 @@ export class ProxyContext {
}
}
export async function getProxyContext(weth:string): Promise<ProxyContext> {
export async function getProxyContext(weth: string): Promise<ProxyContext> {
var context = new ProxyContext();
await context.init(weth);
return context;