Skip to content

Commit

Permalink
deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
hujw77 committed Aug 8, 2024
1 parent 9f91859 commit f01fa12
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 22 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ all :; @forge build
fmt :; @forge fmt
clean :; @forge clean
test :; @forge test
deploy :; @forge script script/Deploy.s.sol:Deploy --chain ${chain-id} --broadcast --verify
deploy :; @forge script script/Deploy.s.sol:Deploy --rpc-url "https://koi-rpc.darwinia.network" --broadcast
dry-run:; @forge script script/Deploy.s.sol:Deploy --rpc-url "https://koi-rpc.darwinia.network"

sync :; @git submodule update --recursive

Expand Down
4 changes: 2 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ koi = "https://koi-rpc.darwinia.network"
crab = "https://crab-rpc.darwinia.network"

[etherscan]
koi = { key = "${ETHERSCAN_DARWINIA_KEY}", url = "https://koi-scan.darwinia.network/api" }
crab = { key = "${ETHERSCAN_DARWINIA_KEY}", url = "https://crab-scan.darwinia.network/api" }
koi = { key = "xxx", url = "https://koi-scan.darwinia.network/api" }
crab = { key = "xxx", url = "https://crab-scan.darwinia.network/api" }
28 changes: 17 additions & 11 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {

contract Deploy is Script {
address gRING = 0xe59B1124d36B51C42D5d66C5F5a9Be92aE1Ce204;
address maintainer = 0x0f14341A7f464320319025540E8Fe48Ad0fe5aec;

address pluginRepoFactory;
DAOFactory daoFactory;
Expand All @@ -32,6 +33,8 @@ contract Deploy is Script {
PluginRepo tokenVotingPluginRepo;
PluginRepo optimisticTokenVotingPluginRepo;

address multisigPlugin = 0x3fE7328eCcBA0A12390C5cF75C61a502d779454f;

DAO ringDAO;

function setUp() public {
Expand Down Expand Up @@ -97,24 +100,24 @@ contract Deploy is Script {
string.concat("ringdao-multisig-", vm.toString(block.timestamp)),
address(multisigPluginSetup),
msg.sender,
"0x00", // TODO: Give these actual values on prod
"0x00"
hex"12", // TODO: Give these actual values on prod
hex"34"
);

tokenVotingPluginRepo = PluginRepoFactory(pluginRepoFactory).createPluginRepoWithFirstVersion(
string.concat("ringdao-token-voting-", vm.toString(block.timestamp)),
address(tokenVotingPluginSetup),
msg.sender,
"0x00", // TODO: Give these actual values on prod
"0x00"
hex"12", // TODO: Give these actual values on prod
hex"34"
);

optimisticTokenVotingPluginRepo = PluginRepoFactory(pluginRepoFactory).createPluginRepoWithFirstVersion(
string.concat("ringdao-optimistic-token-voting-", vm.toString(block.timestamp)),
address(optimisticTokenVotingPluginSetup),
msg.sender,
"0x00", // TODO: Give these actual values on prod
"0x00"
hex"12", // TODO: Give these actual values on prod
hex"34"
);
}

Expand All @@ -131,10 +134,10 @@ contract Deploy is Script {

function getMultisigPluginSetting() public view returns (DAOFactory.PluginSettings memory) {
address[] memory members = new address[](1);
members[0] = 0x0f14341A7f464320319025540E8Fe48Ad0fe5aec;
members[0] = maintainer;
bytes memory pluginSettingsData = abi.encode(
members,
Multisig.MultisigSettings({onlyListed: true, minApprovals: 1, destinationProposalDuration: 15 minutes})
Multisig.MultisigSettings({onlyListed: true, minApprovals: 1, destinationProposalDuration: 60 minutes})
);
PluginRepo.Tag memory tag = PluginRepo.Tag(1, 1);
return DAOFactory.PluginSettings(PluginSetupRef(tag, multisigPluginRepo), pluginSettingsData);
Expand All @@ -146,7 +149,7 @@ contract Deploy is Script {
votingMode: MajorityVotingBase.VotingMode.Standard,
supportThreshold: 500_000, // 50%
minParticipation: 1, // 0.0001%
minDuration: 10 minutes,
minDuration: 60 minutes,
minProposerVotingPower: 1e18
}),
TokenVotingPluginSetup.TokenSettings({addr: gRING, underlyingTotalSupply: 1_000_000_000e18})
Expand All @@ -156,12 +159,15 @@ contract Deploy is Script {
}

function getOptimisticTokenVotingPluginSetting() public view returns (DAOFactory.PluginSettings memory) {
address[] memory proposers = new address[](1);
proposers[0] = multisigPlugin;
bytes memory pluginSettingsData = abi.encode(
OptimisticTokenVotingPlugin.OptimisticGovernanceSettings({
minVetoRatio: 500_000, // 50%
minDuration: 10 minutes
minDuration: 60 minutes
}),
OptimisticTokenVotingPluginSetup.TokenSettings({addr: gRING, underlyingTotalSupply: 1_000_000_000e18})
OptimisticTokenVotingPluginSetup.TokenSettings({addr: gRING, underlyingTotalSupply: 1_000_000_000e18}),
proposers
);
PluginRepo.Tag memory tag = PluginRepo.Tag(1, 1);
return DAOFactory.PluginSettings(PluginSetupRef(tag, optimisticTokenVotingPluginRepo), pluginSettingsData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@ contract OptimisticTokenVotingPlugin is
revert RatioOutOfBounds({limit: RATIO_BASE, actual: _governanceSettings.minVetoRatio});
}

if (_governanceSettings.minDuration < 4 days) {
revert MinDurationOutOfBounds({limit: 4 days, actual: _governanceSettings.minDuration});
if (_governanceSettings.minDuration < 60 minutes) {
revert MinDurationOutOfBounds({limit: 60 minutes, actual: _governanceSettings.minDuration});
}

if (_governanceSettings.minDuration > 365 days) {
Expand Down
6 changes: 0 additions & 6 deletions src/plugins/optimistic-token-voting/build-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
"name": "minDuration",
"type": "uint64",
"description": "The minimum duration of the proposal vote in seconds."
},
{
"internalType": "uint256",
"name": "minProposerVotingPower",
"type": "uint256",
"description": "The minimum voting power required to create a proposal."
}
],
"internalType": "struct OptimisticTokenVotingPlugin.OptimisticGovernanceSettings",
Expand Down

0 comments on commit f01fa12

Please sign in to comment.