-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: mento gov utils scripts * fix: interfaces uses correct pragma * feat: pass and queue proposals * feat: remove --no-cache from script calls * fix: typo on a revert message * feat: improve logging * fix: remove tree that is pushed * fix: remove merge artifacts * feat: update readme
- Loading branch information
Showing
9 changed files
with
129 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity ^0.8.18; | ||
|
||
import { Script } from "./Script.sol"; | ||
import { IGovernanceFactory } from "../../interfaces/IGovernanceFactory.sol"; | ||
import { IGovernor } from "../../interfaces/IGovernor.sol"; | ||
import { console2 } from "forge-std/Script.sol"; | ||
import { Chain } from "./Chain.sol"; | ||
|
||
contract PassProposal is Script { | ||
function run(uint256 proposalId) public { | ||
IGovernor governance = IGovernor(IGovernanceFactory(Chain.governanceFactory()).mentoGovernor()); | ||
|
||
if (governance.state(proposalId) != 1) { | ||
revert(unicode"❌ Proposal is not active"); | ||
} | ||
|
||
(, , , uint256 startBlock, , , , , ) = governance.proposals(proposalId); | ||
uint256 quorumRequired = governance.quorum(startBlock); | ||
console2.log("Quorum required: ", quorumRequired); | ||
|
||
vm.startBroadcast(vm.envUint("MENTO_DEPLOYER_PK")); | ||
{ | ||
governance.castVote(proposalId, 1); | ||
} | ||
vm.stopBroadcast(); | ||
|
||
(, , , , , uint256 forVotes, uint256 againstVotes, , ) = governance.proposals(proposalId); | ||
|
||
console2.log("For votes: ", forVotes); | ||
console2.log("Against votes: ", againstVotes); | ||
|
||
if (forVotes >= quorumRequired && forVotes > againstVotes) { | ||
console2.log(unicode"✅ Proposal has enough votes to pass"); | ||
} else { | ||
revert(unicode"❌ Proposal needs more votes to pass"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity ^0.8.18; | ||
|
||
import { Script } from "./Script.sol"; | ||
import { IGovernanceFactory } from "../../interfaces/IGovernanceFactory.sol"; | ||
import { IGovernor } from "../../interfaces/IGovernor.sol"; | ||
import { console2 } from "forge-std/Script.sol"; | ||
import { Chain } from "./Chain.sol"; | ||
|
||
contract QueueProposal is Script { | ||
function run(uint256 proposalId) public { | ||
IGovernor governance = IGovernor(IGovernanceFactory(Chain.governanceFactory()).mentoGovernor()); | ||
|
||
if (governance.state(proposalId) != 4) { | ||
revert(unicode"❌ Proposal is not successful, cannot be queued"); | ||
} | ||
|
||
vm.startBroadcast(vm.envUint("MENTO_DEPLOYER_PK")); | ||
{ | ||
governance.queue(proposalId); | ||
} | ||
vm.stopBroadcast(); | ||
|
||
console2.log(unicode"✅ Proposal has been queued"); | ||
} | ||
} |