Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
ENV: "local"
PORT: 8080
RELAYER_PK: "0xb80a5165a59af8ce566266fcd0e919e13ed4ecbd57ae952e73ae2cddc08b84c6"
ALCHEMY_API_URL: "http://rinkeby.openlaw.io:8545"
ALCHEMY_API_URL: "https://rpc.xdaichain.com"
JAWSDB_URL: "postgres://snap:pwd123@trib-snapshot-db:5432/snapshot-db"
IGNORE_VOTE_END_CONSTRAINT: "true"
ALLOWED_DOMAINS: "http://localhost:3000"
Expand Down
47 changes: 46 additions & 1 deletion migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ module.exports = async (deployer, network, accounts) => {
case "harmonytest":
res = await deployHarmonyTestDao(deployFunction, network);
break;

case "xdai":
res = await deployXDaiDao(deployFunction,network);
break;
default:
throw Error(`Unsupported network: ${network}`);
}
Expand Down Expand Up @@ -311,3 +313,46 @@ async function deployHarmonyTestDao(deployFunction, network) {
: "0xedC10CFA90A135C41538325DD57FDB4c7b88faf7",
});
}

async function deployXDaiDao(deployFunction, network) {
if (!process.env.DAO_NAME) throw Error("Missing env var: DAO_NAME");
if (!process.env.DAO_OWNER_ADDR)
throw Error("Missing env var: DAO_OWNER_ADDR");
if (!process.env.ERC20_TOKEN_NAME)
throw Error("Missing env var: ERC20_TOKEN_NAME");
if (!process.env.ERC20_TOKEN_SYMBOL)
throw Error("Missing env var: ERC20_TOKEN_SYMBOL");
if (!process.env.ERC20_TOKEN_DECIMALS)
throw Error("Missing env var: ERC20_TOKEN_DECIMALS");
if (!process.env.COUPON_CREATOR_ADDR)
throw Error("Missing env var: COUPON_CREATOR_ADDR");

return await deployDao({
...truffleImports,
deployFunction,
unitPrice: toBN(toWei("100", "finney")),
nbUnits: toBN("100000"),
tokenAddr: ETH_TOKEN,
erc20TokenName: process.env.ERC20_TOKEN_NAME,
erc20TokenSymbol: process.env.ERC20_TOKEN_SYMBOL,
erc20TokenDecimals: process.env.ERC20_TOKEN_DECIMALS,
maxChunks: toBN("100000"),
votingPeriod: process.env.VOTING_PERIOD_SECONDS
? parseInt(process.env.VOTING_PERIOD_SECONDS)
: 600, // 600 secs = 10 mins
gracePeriod: process.env.GRACE_PERIOD_SECONDS
? parseInt(process.env.GRACE_PERIOD_SECONDS)
: 600, // 600 secs = 10 min
offchainVoting: true,
chainId: getNetworkDetails(network).chainId,
deployTestTokens: true,
finalize: false,
maxExternalTokens: 100,
couponCreatorAddress: process.env.COUPON_CREATOR_ADDR,
daoName: process.env.DAO_NAME,
owner: process.env.DAO_OWNER_ADDR,
offchainAdmin: process.env.OFFCHAIN_ADMIN_ADDR
? process.env.OFFCHAIN_ADMIN_ADDR
: "0xedC10CFA90A135C41538325DD57FDB4c7b88faf7",
});
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"deploy:mainnet": "truffle deploy --network mainnet --reset 2>&1 | tee logs/mainnet-deploy.log",
"deploy:harmony": "truffle deploy --network harmony --reset 2>&1 | tee logs/harmony-deploy.log",
"deploy:harmonytest": "truffle deploy --network harmonytest --reset 2>&1 | tee logs/harmonytest-deploy.log",
"deploy:xdai": "truffle deploy --network xdai --reset 2>&1 | tee logs/xdai-deploy.log",
"ganache": "ganache-cli --deterministic -p 7545 --networkId 1337",
"lint": "prettier --list-different 'contracts/**/*.sol' '**/*.js' '**/*.md'",
"lint:fix": "prettier --write 'contracts/**/*.sol' '**/*.js' '**/*.md'",
Expand Down
6 changes: 3 additions & 3 deletions subgraph/config/subgraph-config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[
{
"network": "rinkeby",
"daoFactoryAddress": "0x08e3e2a8b82352d2eE3906Ff57A0B6fCB2eF72c5",
"daoFactoryStartBlock": 9414112,
"network": "xdai",
"daoFactoryAddress": "0xd982A20D1c69704F54c8A33629555b4Ff0F54bf9",
"daoFactoryStartBlock": 19483820,
"GITHUB_USERNAME": "openlawteam",
"SUBGRAPH_NAME": "tribute"
}
Expand Down
5 changes: 5 additions & 0 deletions truffle-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ module.exports = {
network_id: 1666700000,
skipDryRun: true,
},
xdai: {
provider: getNetworkProvider,
network_id: 100,
skipDryRun: true,
},
coverage: {
host: "localhost",
network_id: "*",
Expand Down
4 changes: 4 additions & 0 deletions utils/DeploymentUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,10 @@ const networks = [
name: "harmonytest",
chainId: 1666700000,
},
{
name: "xdai",
chainId: 100,
},
];

const getNetworkDetails = (name) => {
Expand Down