From 2b6e499a3dfc0fbe9f5c11b100e66c8b45941f9f Mon Sep 17 00:00:00 2001 From: Artem Chystiakov Date: Wed, 8 Nov 2023 18:18:13 +0200 Subject: [PATCH 1/2] devnet config --- deploy/4_CoreTokens.migration.js | 6 +- deploy/93_DEXEDAOSetup.migration.js | 94 ++++++++++++++--------------- deploy/config/config.json | 16 ++--- 3 files changed, 60 insertions(+), 56 deletions(-) diff --git a/deploy/4_CoreTokens.migration.js b/deploy/4_CoreTokens.migration.js index 9c21e3bd..1a1b2a88 100644 --- a/deploy/4_CoreTokens.migration.js +++ b/deploy/4_CoreTokens.migration.js @@ -1,14 +1,18 @@ const config = require("./config/config.json"); const ContractsRegistry = artifacts.require("ContractsRegistry"); +const BABT = artifacts.require("BABTMock"); const DexeExpertNft = artifacts.require("ERC721Expert"); module.exports = async (deployer) => { const contractsRegistry = await deployer.deployed(ContractsRegistry, "proxy"); + + // TODO use `config.tokens.BABT` instead + const babtAddress = (await deployer.deploy(BABT)).address; const nftAddress = (await deployer.deploy(DexeExpertNft, { name: "GlobalExpert" })).address; await contractsRegistry.addContract(await contractsRegistry.USD_NAME(), config.tokens.BUSD); await contractsRegistry.addContract(await contractsRegistry.DEXE_NAME(), config.tokens.DEXE); - await contractsRegistry.addContract(await contractsRegistry.BABT_NAME(), config.tokens.BABT); + await contractsRegistry.addContract(await contractsRegistry.BABT_NAME(), babtAddress); await contractsRegistry.addProxyContract(await contractsRegistry.DEXE_EXPERT_NFT_NAME(), nftAddress); }; diff --git a/deploy/93_DEXEDAOSetup.migration.js b/deploy/93_DEXEDAOSetup.migration.js index ccaf2ed3..c130aa0d 100644 --- a/deploy/93_DEXEDAOSetup.migration.js +++ b/deploy/93_DEXEDAOSetup.migration.js @@ -16,13 +16,13 @@ let POOL_PARAMETERS = { earlyCompletion: true, delegatedVotingAllowed: false, validatorsVote: false, - duration: 432000, // 5 days - durationValidators: 432000, // 5 days - quorum: PRECISION.times("5").toFixed(), // 5% - quorumValidators: PRECISION.times("51").toFixed(), // 51% - minVotesForVoting: wei("13"), // 13 votes - minVotesForCreating: wei("10000"), // 10000 votes - executionDelay: 1800, // 30 mins + duration: 600, + durationValidators: 600, + quorum: PRECISION.times("0.00001").toFixed(), + quorumValidators: PRECISION.times("0.00001").toFixed(), + minVotesForVoting: wei("10"), + minVotesForCreating: wei("1"), + executionDelay: 0, rewardsInfo: { rewardToken: ZERO_ADDR, creationReward: 0, @@ -35,13 +35,13 @@ let POOL_PARAMETERS = { earlyCompletion: true, delegatedVotingAllowed: false, validatorsVote: false, - duration: 432000, // 5 days - durationValidators: 432000, // 5 days - quorum: PRECISION.times("5").toFixed(), // 5% - quorumValidators: PRECISION.times("51").toFixed(), // 51% - minVotesForVoting: wei("13"), // 13 votes - minVotesForCreating: wei("10000"), // 10000 votes - executionDelay: 1800, // 30 mins + duration: 600, + durationValidators: 600, + quorum: PRECISION.times("0.00001").toFixed(), + quorumValidators: PRECISION.times("0.00001").toFixed(), + minVotesForVoting: wei("10"), + minVotesForCreating: wei("1"), + executionDelay: 0, rewardsInfo: { rewardToken: ZERO_ADDR, creationReward: 0, @@ -54,13 +54,13 @@ let POOL_PARAMETERS = { earlyCompletion: true, delegatedVotingAllowed: false, validatorsVote: false, - duration: 432000, // 5 days - durationValidators: 432000, // 5 days - quorum: PRECISION.times("5").toFixed(), // 5% - quorumValidators: PRECISION.times("51").toFixed(), // 51% - minVotesForVoting: wei("13"), // 13 votes - minVotesForCreating: wei("10000"), // 10000 votes - executionDelay: 1800, // 30 mins + duration: 600, + durationValidators: 600, + quorum: PRECISION.times("0.00001").toFixed(), + quorumValidators: PRECISION.times("0.00001").toFixed(), + minVotesForVoting: wei("10"), + minVotesForCreating: wei("1"), + executionDelay: 0, rewardsInfo: { rewardToken: ZERO_ADDR, creationReward: 0, @@ -76,9 +76,9 @@ let POOL_PARAMETERS = { name: "DEXE Validator Token", symbol: "DEXEVT", proposalSettings: { - duration: 432000, // 5 days - executionDelay: 1800, // 30 mins - quorum: PRECISION.times("51").toFixed(), // 51% + duration: 600, + executionDelay: 0, + quorum: PRECISION.times("0.00001").toFixed(), }, validators: [], balances: [], @@ -109,21 +109,21 @@ let POOL_PARAMETERS = { }; const DP_SETTINGS = { - earlyCompletion: true, + earlyCompletion: false, delegatedVotingAllowed: true, validatorsVote: false, - duration: 432000, // 5 days - durationValidators: 432000, // 5 days - quorum: PRECISION.times("5").toFixed(), // 5% - quorumValidators: PRECISION.times("51").toFixed(), // 51% - minVotesForVoting: wei("13"), // 13 votes - minVotesForCreating: wei("10000"), // 10000 votes - executionDelay: 1800, // 30 mins + duration: 600, + durationValidators: 600, + quorum: PRECISION.times("0.00001").toFixed(), + quorumValidators: PRECISION.times("0.00001").toFixed(), + minVotesForVoting: wei("10"), + minVotesForCreating: wei("1"), + executionDelay: 0, rewardsInfo: { - rewardToken: ZERO_ADDR, - creationReward: 0, - executionReward: 0, - voteRewardsCoefficient: 0, + rewardToken: config.tokens.DEXE, + creationReward: wei("10"), + executionReward: wei("15"), + voteRewardsCoefficient: PRECISION.times("10").toFixed(), }, executorDescription: "distribution-proposal", }; @@ -132,18 +132,18 @@ const TOKENSALE_SETTINGS = { earlyCompletion: true, delegatedVotingAllowed: false, validatorsVote: false, - duration: 432000, // 5 days - durationValidators: 432000, // 5 days - quorum: PRECISION.times("5").toFixed(), // 5% - quorumValidators: PRECISION.times("51").toFixed(), // 51% - minVotesForVoting: wei("13"), // 13 votes - minVotesForCreating: wei("10000"), // 10000 votes - executionDelay: 1800, // 30 mins + duration: 600, + durationValidators: 600, + quorum: PRECISION.times("0.00001").toFixed(), + quorumValidators: PRECISION.times("0.00001").toFixed(), + minVotesForVoting: wei("10"), + minVotesForCreating: wei("1"), + executionDelay: 0, rewardsInfo: { - rewardToken: ZERO_ADDR, - creationReward: 0, - executionReward: 0, - voteRewardsCoefficient: 0, + rewardToken: config.tokens.DEXE, + creationReward: wei("10"), + executionReward: wei("15"), + voteRewardsCoefficient: PRECISION.times("10").toFixed(), }, executorDescription: "tokensale-proposal", }; diff --git a/deploy/config/config.json b/deploy/config/config.json index 0b7a9e0a..e9cc2297 100644 --- a/deploy/config/config.json +++ b/deploy/config/config.json @@ -1,5 +1,5 @@ { - "owners": [], + "owners": ["0xEd498E75d471C3b874461a87Bb7146453CC8175A", "0xCa543e570e4A1F6DA7cf9C4C7211692Bc105a00A"], "DEXEDAO": { "name": "DeXe Protocol" }, @@ -7,14 +7,14 @@ "documentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" }, "uniswapV2": { - "router": "0x10ED43C718714eb63d5aA57B78B54704E256024E", - "factory": "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73" + "router": "0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3", + "factory": "0xb7926c0430afb07aa7defde6da862ae0bde767bc" }, "tokens": { - "DEXE": "0x6E88056E8376AE7709496BA64D37FA2F8015CE3E", - "BUSD": "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", - "USDT": "0x55d398326f99059fF775485246999027B3197955", - "BABT": "0x2B09d47D550061f995A3b5C6F0Fd58005215D7c8", - "WBNB": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c" + "DEXE": "0xa651EdBbF77e1A2678DEfaE08A33c5004b491457", + "BUSD": "0x78867BbEeF44f2326bF8DDd1941a4439382EF2A7", + "USDT": "0x7ef95a0fee0dd31b22626fa2e10ee6a223f8a684", + "BABT": "0x8ca8a45c53e40bb42b8f5806fc3de00490d789f6", + "WBNB": "0xae13d989dac2f0debff460ac112a837c89baa7cd" } } From ee78a9f71b103912dba0cc3ff186f6dbd0527fcf Mon Sep 17 00:00:00 2001 From: Artem Chystiakov Date: Thu, 9 Nov 2023 16:51:10 +0200 Subject: [PATCH 2/2] environment separation --- .env.example | 3 + deploy/4_CoreTokens.migration.js | 12 +- deploy/6_UniswapV2.migration.js | 6 +- deploy/90_InitAll.migration.js | 12 +- ...1_PriceFeed&UserRegistrySetup.migration.js | 4 +- deploy/93_DEXEDAOSetup.migration.js | 159 +-------------- deploy/95_DEXEDAOSphereXAdmin.migration.js | 3 +- deploy/96_DEXEDAOOwnerwship.migration.js | 2 +- deploy/config/config.json | 20 -- deploy/config/configs/dev.conf.js | 182 ++++++++++++++++++ deploy/config/configs/prod.conf.js | 182 ++++++++++++++++++ deploy/config/configs/stage.conf.js | 182 ++++++++++++++++++ deploy/config/utils.js | 17 ++ 13 files changed, 595 insertions(+), 189 deletions(-) delete mode 100644 deploy/config/config.json create mode 100644 deploy/config/configs/dev.conf.js create mode 100644 deploy/config/configs/prod.conf.js create mode 100644 deploy/config/configs/stage.conf.js diff --git a/.env.example b/.env.example index 239c9588..291a1649 100644 --- a/.env.example +++ b/.env.example @@ -7,3 +7,6 @@ COINMARKETCAP_KEY = "COINMARKETCAP API KEY" # Available targets: 'ethers-v5', 'truffle-v5' and 'web3-v1' # By default 'ethers-v5' TYPECHAIN_TARGET = "TYPECHAIN TARGET" + +# Environment +ENVIRONMENT = "PROD|STAGE|DEV" diff --git a/deploy/4_CoreTokens.migration.js b/deploy/4_CoreTokens.migration.js index 1a1b2a88..fb4917de 100644 --- a/deploy/4_CoreTokens.migration.js +++ b/deploy/4_CoreTokens.migration.js @@ -1,4 +1,6 @@ -const config = require("./config/config.json"); +const config = require("./config/utils.js").getConfig(); + +const { ZERO_ADDR } = require("../scripts/utils/constants"); const ContractsRegistry = artifacts.require("ContractsRegistry"); const BABT = artifacts.require("BABTMock"); @@ -7,8 +9,12 @@ const DexeExpertNft = artifacts.require("ERC721Expert"); module.exports = async (deployer) => { const contractsRegistry = await deployer.deployed(ContractsRegistry, "proxy"); - // TODO use `config.tokens.BABT` instead - const babtAddress = (await deployer.deploy(BABT)).address; + let babtAddress = config.tokens.BABT; + + if (babtAddress == ZERO_ADDR) { + babtAddress = (await deployer.deploy(BABT)).address; + } + const nftAddress = (await deployer.deploy(DexeExpertNft, { name: "GlobalExpert" })).address; await contractsRegistry.addContract(await contractsRegistry.USD_NAME(), config.tokens.BUSD); diff --git a/deploy/6_UniswapV2.migration.js b/deploy/6_UniswapV2.migration.js index a88bd655..e286a546 100644 --- a/deploy/6_UniswapV2.migration.js +++ b/deploy/6_UniswapV2.migration.js @@ -1,10 +1,10 @@ -const config = require("./config/config.json"); +const config = require("./config/utils.js").getConfig(); const ContractsRegistry = artifacts.require("ContractsRegistry"); module.exports = async (deployer) => { const contractsRegistry = await deployer.deployed(ContractsRegistry, "proxy"); - await contractsRegistry.addContract(await contractsRegistry.UNISWAP_V2_ROUTER_NAME(), config.uniswapV2.router); - await contractsRegistry.addContract(await contractsRegistry.UNISWAP_V2_FACTORY_NAME(), config.uniswapV2.factory); + await contractsRegistry.addContract(await contractsRegistry.UNISWAP_V2_ROUTER_NAME(), config.uniswap.router); + await contractsRegistry.addContract(await contractsRegistry.UNISWAP_V2_FACTORY_NAME(), config.uniswap.factory); }; diff --git a/deploy/90_InitAll.migration.js b/deploy/90_InitAll.migration.js index 2f877554..7c5299e1 100644 --- a/deploy/90_InitAll.migration.js +++ b/deploy/90_InitAll.migration.js @@ -1,6 +1,6 @@ const { Reporter } = require("@solarity/hardhat-migrate"); -const { PRECISION } = require("../scripts/utils/constants"); +const config = require("./config/utils.js").getConfig(); const ContractsRegistry = artifacts.require("ContractsRegistry"); const UserRegistry = artifacts.require("UserRegistry"); @@ -11,14 +11,6 @@ const PoolFactory = artifacts.require("PoolFactory"); const PoolRegistry = artifacts.require("PoolRegistry"); const SphereXEngine = artifacts.require("SphereXEngine"); -const DEFAULT_CORE_PROPERTIES = { - govVotesLimit: 50, - govCommissionPercentage: PRECISION.times(30).toFixed(), - tokenSaleProposalCommissionPercentage: PRECISION.toFixed(), - micropoolVoteRewardsPercentage: PRECISION.times(20).toFixed(), - treasuryVoteRewardsPercentage: PRECISION.times(1.618).toFixed(), -}; - module.exports = async (deployer) => { const contractsRegistry = await deployer.deployed(ContractsRegistry, "proxy"); @@ -41,7 +33,7 @@ module.exports = async (deployer) => { //////////////////////////////////////////////////////////// await userRegistry.__UserRegistry_init(await contractsRegistry.USER_REGISTRY_NAME()); - await coreProperties.__CoreProperties_init(DEFAULT_CORE_PROPERTIES); + await coreProperties.__CoreProperties_init(config.DEFAULT_CORE_PROPERTIES); await priceFeed.__PriceFeed_init(); diff --git a/deploy/91_PriceFeed&UserRegistrySetup.migration.js b/deploy/91_PriceFeed&UserRegistrySetup.migration.js index 97c88c6b..8667e8e5 100644 --- a/deploy/91_PriceFeed&UserRegistrySetup.migration.js +++ b/deploy/91_PriceFeed&UserRegistrySetup.migration.js @@ -1,4 +1,4 @@ -const config = require("./config/config.json"); +const config = require("./config/utils.js").getConfig(); const ContractsRegistry = artifacts.require("ContractsRegistry"); const PriceFeed = artifacts.require("PriceFeed"); @@ -13,5 +13,5 @@ module.exports = async (deployer) => { let pathAddresses = [config.tokens.WBNB, config.tokens.USDT, config.tokens.BUSD]; await priceFeed.addPathTokens(pathAddresses); - await userRegistry.setPrivacyPolicyDocumentHash(config.userRegistry.documentHash); + await userRegistry.setPrivacyPolicyDocumentHash(config.DOCUMENT_HASH); }; diff --git a/deploy/93_DEXEDAOSetup.migration.js b/deploy/93_DEXEDAOSetup.migration.js index c130aa0d..7094ee13 100644 --- a/deploy/93_DEXEDAOSetup.migration.js +++ b/deploy/93_DEXEDAOSetup.migration.js @@ -1,170 +1,31 @@ const { Reporter } = require("@solarity/hardhat-migrate"); -const config = require("./config/config.json"); -const { getBytesPolynomialPowerInit } = require("./config/utils.js"); +const config = require("./config/utils.js").getConfig(); -const { ZERO_ADDR, PRECISION } = require("../scripts/utils/constants"); -const { accounts, wei } = require("../scripts/utils/utils"); +const { accounts } = require("../scripts/utils/utils"); const ContractsRegistry = artifacts.require("ContractsRegistry"); const PoolFactory = artifacts.require("PoolFactory"); -let POOL_PARAMETERS = { - settingsParams: { - proposalSettings: [ - { - earlyCompletion: true, - delegatedVotingAllowed: false, - validatorsVote: false, - duration: 600, - durationValidators: 600, - quorum: PRECISION.times("0.00001").toFixed(), - quorumValidators: PRECISION.times("0.00001").toFixed(), - minVotesForVoting: wei("10"), - minVotesForCreating: wei("1"), - executionDelay: 0, - rewardsInfo: { - rewardToken: ZERO_ADDR, - creationReward: 0, - executionReward: 0, - voteRewardsCoefficient: 0, - }, - executorDescription: "default", - }, - { - earlyCompletion: true, - delegatedVotingAllowed: false, - validatorsVote: false, - duration: 600, - durationValidators: 600, - quorum: PRECISION.times("0.00001").toFixed(), - quorumValidators: PRECISION.times("0.00001").toFixed(), - minVotesForVoting: wei("10"), - minVotesForCreating: wei("1"), - executionDelay: 0, - rewardsInfo: { - rewardToken: ZERO_ADDR, - creationReward: 0, - executionReward: 0, - voteRewardsCoefficient: 0, - }, - executorDescription: "internal", - }, - { - earlyCompletion: true, - delegatedVotingAllowed: false, - validatorsVote: false, - duration: 600, - durationValidators: 600, - quorum: PRECISION.times("0.00001").toFixed(), - quorumValidators: PRECISION.times("0.00001").toFixed(), - minVotesForVoting: wei("10"), - minVotesForCreating: wei("1"), - executionDelay: 0, - rewardsInfo: { - rewardToken: ZERO_ADDR, - creationReward: 0, - executionReward: 0, - voteRewardsCoefficient: 0, - }, - executorDescription: "validators", - }, - ], - additionalProposalExecutors: [], - }, - validatorsParams: { - name: "DEXE Validator Token", - symbol: "DEXEVT", - proposalSettings: { - duration: 600, - executionDelay: 0, - quorum: PRECISION.times("0.00001").toFixed(), - }, - validators: [], - balances: [], - }, - userKeeperParams: { - tokenAddress: config.tokens.DEXE, - nftAddress: ZERO_ADDR, - individualPower: 0, - nftsTotalSupply: 0, - }, - tokenParams: { - name: "", - symbol: "", - users: [], - cap: 0, - mintedTotal: 0, - amounts: [], - }, - votePowerParams: { - voteType: 1, - initData: getBytesPolynomialPowerInit(PRECISION.times("1.08"), PRECISION.times("0.92"), PRECISION.times("0.97")), - presetAddress: ZERO_ADDR, - }, - verifier: ZERO_ADDR, - onlyBABTHolders: false, - descriptionURL: "", - name: config.DEXEDAO.name, -}; - -const DP_SETTINGS = { - earlyCompletion: false, - delegatedVotingAllowed: true, - validatorsVote: false, - duration: 600, - durationValidators: 600, - quorum: PRECISION.times("0.00001").toFixed(), - quorumValidators: PRECISION.times("0.00001").toFixed(), - minVotesForVoting: wei("10"), - minVotesForCreating: wei("1"), - executionDelay: 0, - rewardsInfo: { - rewardToken: config.tokens.DEXE, - creationReward: wei("10"), - executionReward: wei("15"), - voteRewardsCoefficient: PRECISION.times("10").toFixed(), - }, - executorDescription: "distribution-proposal", -}; - -const TOKENSALE_SETTINGS = { - earlyCompletion: true, - delegatedVotingAllowed: false, - validatorsVote: false, - duration: 600, - durationValidators: 600, - quorum: PRECISION.times("0.00001").toFixed(), - quorumValidators: PRECISION.times("0.00001").toFixed(), - minVotesForVoting: wei("10"), - minVotesForCreating: wei("1"), - executionDelay: 0, - rewardsInfo: { - rewardToken: config.tokens.DEXE, - creationReward: wei("10"), - executionReward: wei("15"), - voteRewardsCoefficient: PRECISION.times("10").toFixed(), - }, - executorDescription: "tokensale-proposal", -}; - module.exports = async (deployer) => { const contractsRegistry = await deployer.deployed(ContractsRegistry, "proxy"); const poolFactory = await deployer.deployed(PoolFactory, await contractsRegistry.getPoolFactoryContract()); - const predictedGovAddresses = await poolFactory.predictGovAddresses(await accounts(0), POOL_PARAMETERS.name); + const predictedGovAddresses = await poolFactory.predictGovAddresses(await accounts(0), config.DEXE_DAO_NAME); deployer.dexeDaoAddress = predictedGovAddresses.govPool; await contractsRegistry.addContract(await contractsRegistry.TREASURY_NAME(), deployer.dexeDaoAddress); - POOL_PARAMETERS.settingsParams.proposalSettings.push(DP_SETTINGS); - POOL_PARAMETERS.settingsParams.additionalProposalExecutors.push(predictedGovAddresses.distributionProposal); + const PARAMETERS = config.POOL_PARAMETERS; + + PARAMETERS.settingsParams.proposalSettings.push(config.DP_SETTINGS); + PARAMETERS.settingsParams.additionalProposalExecutors.push(predictedGovAddresses.distributionProposal); - POOL_PARAMETERS.settingsParams.proposalSettings.push(TOKENSALE_SETTINGS); - POOL_PARAMETERS.settingsParams.additionalProposalExecutors.push(predictedGovAddresses.govTokenSale); + PARAMETERS.settingsParams.proposalSettings.push(config.TOKENSALE_SETTINGS); + PARAMETERS.settingsParams.additionalProposalExecutors.push(predictedGovAddresses.govTokenSale); - await poolFactory.deployGovPool(POOL_PARAMETERS); + await poolFactory.deployGovPool(PARAMETERS); Reporter.reportContracts(["DEXE DAO", deployer.dexeDaoAddress]); }; diff --git a/deploy/95_DEXEDAOSphereXAdmin.migration.js b/deploy/95_DEXEDAOSphereXAdmin.migration.js index 66b45eb8..f557183b 100644 --- a/deploy/95_DEXEDAOSphereXAdmin.migration.js +++ b/deploy/95_DEXEDAOSphereXAdmin.migration.js @@ -1,6 +1,7 @@ const { Reporter } = require("@solarity/hardhat-migrate"); -const config = require("./config/config.json"); +const config = require("./config/utils.js").getConfig(); + const { accounts } = require("../scripts/utils/utils"); const ContractsRegistry = artifacts.require("ContractsRegistry"); diff --git a/deploy/96_DEXEDAOOwnerwship.migration.js b/deploy/96_DEXEDAOOwnerwship.migration.js index 791b99db..e549566a 100644 --- a/deploy/96_DEXEDAOOwnerwship.migration.js +++ b/deploy/96_DEXEDAOOwnerwship.migration.js @@ -1,4 +1,4 @@ -const config = require("./config/config.json"); +const config = require("./config/utils.js").getConfig(); const ContractsRegistry = artifacts.require("ContractsRegistry"); const PoolRegistry = artifacts.require("PoolRegistry"); diff --git a/deploy/config/config.json b/deploy/config/config.json deleted file mode 100644 index e9cc2297..00000000 --- a/deploy/config/config.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "owners": ["0xEd498E75d471C3b874461a87Bb7146453CC8175A", "0xCa543e570e4A1F6DA7cf9C4C7211692Bc105a00A"], - "DEXEDAO": { - "name": "DeXe Protocol" - }, - "userRegistry": { - "documentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - "uniswapV2": { - "router": "0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3", - "factory": "0xb7926c0430afb07aa7defde6da862ae0bde767bc" - }, - "tokens": { - "DEXE": "0xa651EdBbF77e1A2678DEfaE08A33c5004b491457", - "BUSD": "0x78867BbEeF44f2326bF8DDd1941a4439382EF2A7", - "USDT": "0x7ef95a0fee0dd31b22626fa2e10ee6a223f8a684", - "BABT": "0x8ca8a45c53e40bb42b8f5806fc3de00490d789f6", - "WBNB": "0xae13d989dac2f0debff460ac112a837c89baa7cd" - } -} diff --git a/deploy/config/configs/dev.conf.js b/deploy/config/configs/dev.conf.js new file mode 100644 index 00000000..e7d18959 --- /dev/null +++ b/deploy/config/configs/dev.conf.js @@ -0,0 +1,182 @@ +const { ZERO_ADDR, PRECISION } = require("../../../scripts/utils/constants.js"); +const { wei } = require("../../../scripts/utils/utils.js"); + +const { getBytesPolynomialPowerInit } = require("../utils.js"); + +const owners = ["0xEd498E75d471C3b874461a87Bb7146453CC8175A", "0xCa543e570e4A1F6DA7cf9C4C7211692Bc105a00A"]; + +const tokens = { + DEXE: "0xf42F27612af98F40865Dc3CB8531d3aa4C44A8E5", + BUSD: "0x78867BbEeF44f2326bF8DDd1941a4439382EF2A7", + USDT: "0x7ef95a0fee0dd31b22626fa2e10ee6a223f8a684", + BABT: "0x0000000000000000000000000000000000000000", + WBNB: "0xae13d989dac2f0debff460ac112a837c89baa7cd", +}; + +const uniswap = { + router: "0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3", + factory: "0xb7926c0430afb07aa7defde6da862ae0bde767bc", +}; + +const DEXE_DAO_NAME = "DeXe Protocol"; + +const DOCUMENT_HASH = "0x0000000000000000000000000000000000000000000000000000000000000000"; + +const DEFAULT_CORE_PROPERTIES = { + govVotesLimit: 50, + govCommissionPercentage: PRECISION.times(30).toFixed(), + tokenSaleProposalCommissionPercentage: PRECISION.toFixed(), + micropoolVoteRewardsPercentage: PRECISION.times(20).toFixed(), + treasuryVoteRewardsPercentage: PRECISION.times(1.618).toFixed(), +}; + +const POOL_PARAMETERS = { + settingsParams: { + proposalSettings: [ + { + earlyCompletion: true, + delegatedVotingAllowed: false, + validatorsVote: false, + duration: 600, + durationValidators: 600, + quorum: PRECISION.times("0.00001").toFixed(), + quorumValidators: PRECISION.times("0.00001").toFixed(), + minVotesForVoting: wei("10"), + minVotesForCreating: wei("1"), + executionDelay: 0, + rewardsInfo: { + rewardToken: ZERO_ADDR, + creationReward: 0, + executionReward: 0, + voteRewardsCoefficient: 0, + }, + executorDescription: "default", + }, + { + earlyCompletion: true, + delegatedVotingAllowed: false, + validatorsVote: false, + duration: 600, + durationValidators: 600, + quorum: PRECISION.times("0.00001").toFixed(), + quorumValidators: PRECISION.times("0.00001").toFixed(), + minVotesForVoting: wei("10"), + minVotesForCreating: wei("1"), + executionDelay: 0, + rewardsInfo: { + rewardToken: ZERO_ADDR, + creationReward: 0, + executionReward: 0, + voteRewardsCoefficient: 0, + }, + executorDescription: "internal", + }, + { + earlyCompletion: true, + delegatedVotingAllowed: false, + validatorsVote: false, + duration: 600, + durationValidators: 600, + quorum: PRECISION.times("0.00001").toFixed(), + quorumValidators: PRECISION.times("0.00001").toFixed(), + minVotesForVoting: wei("10"), + minVotesForCreating: wei("1"), + executionDelay: 0, + rewardsInfo: { + rewardToken: ZERO_ADDR, + creationReward: 0, + executionReward: 0, + voteRewardsCoefficient: 0, + }, + executorDescription: "validators", + }, + ], + additionalProposalExecutors: [], + }, + validatorsParams: { + name: "DEXE Validator Token", + symbol: "DEXEVT", + proposalSettings: { + duration: 600, + executionDelay: 0, + quorum: PRECISION.times("0.00001").toFixed(), + }, + validators: [], + balances: [], + }, + userKeeperParams: { + tokenAddress: tokens.DEXE, + nftAddress: ZERO_ADDR, + individualPower: 0, + nftsTotalSupply: 0, + }, + tokenParams: { + name: "", + symbol: "", + users: [], + cap: 0, + mintedTotal: 0, + amounts: [], + }, + votePowerParams: { + voteType: 1, + initData: getBytesPolynomialPowerInit(PRECISION.times("1.08"), PRECISION.times("0.92"), PRECISION.times("0.97")), + presetAddress: ZERO_ADDR, + }, + verifier: ZERO_ADDR, + onlyBABTHolders: false, + descriptionURL: "", + name: DEXE_DAO_NAME, +}; + +const DP_SETTINGS = { + earlyCompletion: true, + delegatedVotingAllowed: true, + validatorsVote: false, + duration: 600, + durationValidators: 600, + quorum: PRECISION.times("0.00001").toFixed(), + quorumValidators: PRECISION.times("0.00001").toFixed(), + minVotesForVoting: wei("10"), + minVotesForCreating: wei("1"), + executionDelay: 0, + rewardsInfo: { + rewardToken: ZERO_ADDR, + creationReward: 0, + executionReward: 0, + voteRewardsCoefficient: 0, + }, + executorDescription: "distribution-proposal", +}; + +const TOKENSALE_SETTINGS = { + earlyCompletion: true, + delegatedVotingAllowed: false, + validatorsVote: false, + duration: 600, + durationValidators: 600, + quorum: PRECISION.times("0.00001").toFixed(), + quorumValidators: PRECISION.times("0.00001").toFixed(), + minVotesForVoting: wei("10"), + minVotesForCreating: wei("1"), + executionDelay: 0, + rewardsInfo: { + rewardToken: ZERO_ADDR, + creationReward: 0, + executionReward: 0, + voteRewardsCoefficient: 0, + }, + executorDescription: "tokensale-proposal", +}; + +module.exports = { + owners, + tokens, + uniswap, + DEXE_DAO_NAME, + DOCUMENT_HASH, + DEFAULT_CORE_PROPERTIES, + POOL_PARAMETERS, + DP_SETTINGS, + TOKENSALE_SETTINGS, +}; diff --git a/deploy/config/configs/prod.conf.js b/deploy/config/configs/prod.conf.js new file mode 100644 index 00000000..2abf112d --- /dev/null +++ b/deploy/config/configs/prod.conf.js @@ -0,0 +1,182 @@ +const { ZERO_ADDR, PRECISION } = require("../../../scripts/utils/constants.js"); +const { wei } = require("../../../scripts/utils/utils.js"); + +const { getBytesPolynomialPowerInit } = require("../utils.js"); + +const owners = []; + +const tokens = { + DEXE: "0x6E88056E8376AE7709496BA64D37FA2F8015CE3E", + BUSD: "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", + USDT: "0x55d398326f99059fF775485246999027B3197955", + BABT: "0x2B09d47D550061f995A3b5C6F0Fd58005215D7c8", + WBNB: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", +}; + +const uniswap = { + router: "0x10ED43C718714eb63d5aA57B78B54704E256024E", + factory: "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73", +}; + +const DEXE_DAO_NAME = "DeXe Protocol"; + +const DOCUMENT_HASH = "0x0000000000000000000000000000000000000000000000000000000000000000"; + +const DEFAULT_CORE_PROPERTIES = { + govVotesLimit: 50, + govCommissionPercentage: PRECISION.times(30).toFixed(), + tokenSaleProposalCommissionPercentage: PRECISION.toFixed(), + micropoolVoteRewardsPercentage: PRECISION.times(20).toFixed(), + treasuryVoteRewardsPercentage: PRECISION.times(1.618).toFixed(), +}; + +const POOL_PARAMETERS = { + settingsParams: { + proposalSettings: [ + { + earlyCompletion: true, + delegatedVotingAllowed: false, + validatorsVote: false, + duration: 432000, // 5 days + durationValidators: 432000, // 5 days + quorum: PRECISION.times("5").toFixed(), // 5% + quorumValidators: PRECISION.times("51").toFixed(), // 51% + minVotesForVoting: wei("13"), // 13 votes + minVotesForCreating: wei("10000"), // 10000 votes + executionDelay: 1800, // 30 mins + rewardsInfo: { + rewardToken: ZERO_ADDR, + creationReward: 0, + executionReward: 0, + voteRewardsCoefficient: 0, + }, + executorDescription: "default", + }, + { + earlyCompletion: true, + delegatedVotingAllowed: false, + validatorsVote: false, + duration: 432000, // 5 days + durationValidators: 432000, // 5 days + quorum: PRECISION.times("5").toFixed(), // 5% + quorumValidators: PRECISION.times("51").toFixed(), // 51% + minVotesForVoting: wei("13"), // 13 votes + minVotesForCreating: wei("10000"), // 10000 votes + executionDelay: 1800, // 30 mins + rewardsInfo: { + rewardToken: ZERO_ADDR, + creationReward: 0, + executionReward: 0, + voteRewardsCoefficient: 0, + }, + executorDescription: "internal", + }, + { + earlyCompletion: true, + delegatedVotingAllowed: false, + validatorsVote: false, + duration: 432000, // 5 days + durationValidators: 432000, // 5 days + quorum: PRECISION.times("5").toFixed(), // 5% + quorumValidators: PRECISION.times("51").toFixed(), // 51% + minVotesForVoting: wei("13"), // 13 votes + minVotesForCreating: wei("10000"), // 10000 votes + executionDelay: 1800, // 30 mins + rewardsInfo: { + rewardToken: ZERO_ADDR, + creationReward: 0, + executionReward: 0, + voteRewardsCoefficient: 0, + }, + executorDescription: "validators", + }, + ], + additionalProposalExecutors: [], + }, + validatorsParams: { + name: "DEXE Validator Token", + symbol: "DEXEVT", + proposalSettings: { + duration: 432000, // 5 days + executionDelay: 1800, // 30 mins + quorum: PRECISION.times("51").toFixed(), // 51% + }, + validators: [], + balances: [], + }, + userKeeperParams: { + tokenAddress: tokens.DEXE, + nftAddress: ZERO_ADDR, + individualPower: 0, + nftsTotalSupply: 0, + }, + tokenParams: { + name: "", + symbol: "", + users: [], + cap: 0, + mintedTotal: 0, + amounts: [], + }, + votePowerParams: { + voteType: 1, + initData: getBytesPolynomialPowerInit(PRECISION.times("1.08"), PRECISION.times("0.92"), PRECISION.times("0.97")), + presetAddress: ZERO_ADDR, + }, + verifier: ZERO_ADDR, + onlyBABTHolders: false, + descriptionURL: "", + name: DEXE_DAO_NAME, +}; + +const DP_SETTINGS = { + earlyCompletion: true, + delegatedVotingAllowed: true, + validatorsVote: false, + duration: 432000, // 5 days + durationValidators: 432000, // 5 days + quorum: PRECISION.times("5").toFixed(), // 5% + quorumValidators: PRECISION.times("51").toFixed(), // 51% + minVotesForVoting: wei("13"), // 13 votes + minVotesForCreating: wei("10000"), // 10000 votes + executionDelay: 1800, // 30 mins + rewardsInfo: { + rewardToken: ZERO_ADDR, + creationReward: 0, + executionReward: 0, + voteRewardsCoefficient: 0, + }, + executorDescription: "distribution-proposal", +}; + +const TOKENSALE_SETTINGS = { + earlyCompletion: true, + delegatedVotingAllowed: false, + validatorsVote: false, + duration: 432000, // 5 days + durationValidators: 432000, // 5 days + quorum: PRECISION.times("5").toFixed(), // 5% + quorumValidators: PRECISION.times("51").toFixed(), // 51% + minVotesForVoting: wei("13"), // 13 votes + minVotesForCreating: wei("10000"), // 10000 votes + executionDelay: 1800, // 30 mins + rewardsInfo: { + rewardToken: ZERO_ADDR, + creationReward: 0, + executionReward: 0, + voteRewardsCoefficient: 0, + }, + executorDescription: "tokensale-proposal", +}; + +module.exports = { + owners, + tokens, + uniswap, + DEXE_DAO_NAME, + DOCUMENT_HASH, + DEFAULT_CORE_PROPERTIES, + POOL_PARAMETERS, + DP_SETTINGS, + TOKENSALE_SETTINGS, +}; diff --git a/deploy/config/configs/stage.conf.js b/deploy/config/configs/stage.conf.js new file mode 100644 index 00000000..51d58343 --- /dev/null +++ b/deploy/config/configs/stage.conf.js @@ -0,0 +1,182 @@ +const { ZERO_ADDR, PRECISION } = require("../../../scripts/utils/constants.js"); +const { wei } = require("../../../scripts/utils/utils.js"); + +const { getBytesPolynomialPowerInit } = require("../utils.js"); + +const owners = ["0xEd498E75d471C3b874461a87Bb7146453CC8175A", "0xCa543e570e4A1F6DA7cf9C4C7211692Bc105a00A"]; + +const tokens = { + DEXE: "0xf42F27612af98F40865Dc3CB8531d3aa4C44A8E5", + BUSD: "0x78867BbEeF44f2326bF8DDd1941a4439382EF2A7", + USDT: "0x7ef95a0fee0dd31b22626fa2e10ee6a223f8a684", + BABT: "0x8ca8a45c53e40bb42b8f5806fc3de00490d789f6", + WBNB: "0xae13d989dac2f0debff460ac112a837c89baa7cd", +}; + +const uniswap = { + router: "0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3", + factory: "0xb7926c0430afb07aa7defde6da862ae0bde767bc", +}; + +const DEXE_DAO_NAME = "DeXe Protocol"; + +const DOCUMENT_HASH = "0x0000000000000000000000000000000000000000000000000000000000000000"; + +const DEFAULT_CORE_PROPERTIES = { + govVotesLimit: 50, + govCommissionPercentage: PRECISION.times(30).toFixed(), + tokenSaleProposalCommissionPercentage: PRECISION.toFixed(), + micropoolVoteRewardsPercentage: PRECISION.times(20).toFixed(), + treasuryVoteRewardsPercentage: PRECISION.times(1.618).toFixed(), +}; + +const POOL_PARAMETERS = { + settingsParams: { + proposalSettings: [ + { + earlyCompletion: true, + delegatedVotingAllowed: false, + validatorsVote: false, + duration: 432000, // 5 days + durationValidators: 432000, // 5 days + quorum: PRECISION.times("5").toFixed(), // 5% + quorumValidators: PRECISION.times("51").toFixed(), // 51% + minVotesForVoting: wei("13"), // 13 votes + minVotesForCreating: wei("10000"), // 10000 votes + executionDelay: 1800, // 30 mins + rewardsInfo: { + rewardToken: ZERO_ADDR, + creationReward: 0, + executionReward: 0, + voteRewardsCoefficient: 0, + }, + executorDescription: "default", + }, + { + earlyCompletion: true, + delegatedVotingAllowed: false, + validatorsVote: false, + duration: 432000, // 5 days + durationValidators: 432000, // 5 days + quorum: PRECISION.times("5").toFixed(), // 5% + quorumValidators: PRECISION.times("51").toFixed(), // 51% + minVotesForVoting: wei("13"), // 13 votes + minVotesForCreating: wei("10000"), // 10000 votes + executionDelay: 1800, // 30 mins + rewardsInfo: { + rewardToken: ZERO_ADDR, + creationReward: 0, + executionReward: 0, + voteRewardsCoefficient: 0, + }, + executorDescription: "internal", + }, + { + earlyCompletion: true, + delegatedVotingAllowed: false, + validatorsVote: false, + duration: 432000, // 5 days + durationValidators: 432000, // 5 days + quorum: PRECISION.times("5").toFixed(), // 5% + quorumValidators: PRECISION.times("51").toFixed(), // 51% + minVotesForVoting: wei("13"), // 13 votes + minVotesForCreating: wei("10000"), // 10000 votes + executionDelay: 1800, // 30 mins + rewardsInfo: { + rewardToken: ZERO_ADDR, + creationReward: 0, + executionReward: 0, + voteRewardsCoefficient: 0, + }, + executorDescription: "validators", + }, + ], + additionalProposalExecutors: [], + }, + validatorsParams: { + name: "DEXE Validator Token", + symbol: "DEXEVT", + proposalSettings: { + duration: 432000, // 5 days + executionDelay: 1800, // 30 mins + quorum: PRECISION.times("51").toFixed(), // 51% + }, + validators: [], + balances: [], + }, + userKeeperParams: { + tokenAddress: tokens.DEXE, + nftAddress: ZERO_ADDR, + individualPower: 0, + nftsTotalSupply: 0, + }, + tokenParams: { + name: "", + symbol: "", + users: [], + cap: 0, + mintedTotal: 0, + amounts: [], + }, + votePowerParams: { + voteType: 1, + initData: getBytesPolynomialPowerInit(PRECISION.times("1.08"), PRECISION.times("0.92"), PRECISION.times("0.97")), + presetAddress: ZERO_ADDR, + }, + verifier: ZERO_ADDR, + onlyBABTHolders: false, + descriptionURL: "", + name: DEXE_DAO_NAME, +}; + +const DP_SETTINGS = { + earlyCompletion: true, + delegatedVotingAllowed: true, + validatorsVote: false, + duration: 432000, // 5 days + durationValidators: 432000, // 5 days + quorum: PRECISION.times("5").toFixed(), // 5% + quorumValidators: PRECISION.times("51").toFixed(), // 51% + minVotesForVoting: wei("13"), // 13 votes + minVotesForCreating: wei("10000"), // 10000 votes + executionDelay: 1800, // 30 mins + rewardsInfo: { + rewardToken: ZERO_ADDR, + creationReward: 0, + executionReward: 0, + voteRewardsCoefficient: 0, + }, + executorDescription: "distribution-proposal", +}; + +const TOKENSALE_SETTINGS = { + earlyCompletion: true, + delegatedVotingAllowed: false, + validatorsVote: false, + duration: 432000, // 5 days + durationValidators: 432000, // 5 days + quorum: PRECISION.times("5").toFixed(), // 5% + quorumValidators: PRECISION.times("51").toFixed(), // 51% + minVotesForVoting: wei("13"), // 13 votes + minVotesForCreating: wei("10000"), // 10000 votes + executionDelay: 1800, // 30 mins + rewardsInfo: { + rewardToken: ZERO_ADDR, + creationReward: 0, + executionReward: 0, + voteRewardsCoefficient: 0, + }, + executorDescription: "tokensale-proposal", +}; + +module.exports = { + owners, + tokens, + uniswap, + DEXE_DAO_NAME, + DOCUMENT_HASH, + DEFAULT_CORE_PROPERTIES, + POOL_PARAMETERS, + DP_SETTINGS, + TOKENSALE_SETTINGS, +}; diff --git a/deploy/config/utils.js b/deploy/config/utils.js index c75481cf..dd3abda6 100644 --- a/deploy/config/utils.js +++ b/deploy/config/utils.js @@ -1,3 +1,19 @@ +const getConfig = () => { + if (process.env.ENVIRONMENT == "PROD") { + return require("./configs/prod.conf.js"); + } + + if (process.env.ENVIRONMENT == "STAGE") { + return require("./configs/stage.conf.js"); + } + + if (process.env.ENVIRONMENT == "DEV") { + return require("./configs/dev.conf.js"); + } + + throw Error("No environment config specified"); +}; + const getBytesPolynomialPowerInit = (k1, k2, k3) => { return web3.eth.abi.encodeFunctionCall( { @@ -23,5 +39,6 @@ const getBytesPolynomialPowerInit = (k1, k2, k3) => { }; module.exports = { + getConfig, getBytesPolynomialPowerInit, };