Skip to content

Commit

Permalink
Merge pull request #178 from dexe-network/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Arvolear authored Nov 9, 2023
2 parents 50cf657 + ee78a9f commit 9a36ccf
Show file tree
Hide file tree
Showing 13 changed files with 598 additions and 188 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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"
14 changes: 12 additions & 2 deletions deploy/4_CoreTokens.migration.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
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");
const DexeExpertNft = artifacts.require("ERC721Expert");

module.exports = async (deployer) => {
const contractsRegistry = await deployer.deployed(ContractsRegistry, "proxy");

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);
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);
};
6 changes: 3 additions & 3 deletions deploy/6_UniswapV2.migration.js
Original file line number Diff line number Diff line change
@@ -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);
};
12 changes: 2 additions & 10 deletions deploy/90_InitAll.migration.js
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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");

Expand All @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions deploy/91_PriceFeed&UserRegistrySetup.migration.js
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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);
};
159 changes: 10 additions & 149 deletions deploy/93_DEXEDAOSetup.migration.js
Original file line number Diff line number Diff line change
@@ -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: 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: 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: 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 = 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]);
};
3 changes: 2 additions & 1 deletion deploy/95_DEXEDAOSphereXAdmin.migration.js
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
2 changes: 1 addition & 1 deletion deploy/96_DEXEDAOOwnerwship.migration.js
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
20 changes: 0 additions & 20 deletions deploy/config/config.json

This file was deleted.

Loading

0 comments on commit 9a36ccf

Please sign in to comment.