-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(space): export proposal id when executing #245
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
48c525b
feat: export proposal id when executing
478659c
refactor: remove proposalId from args unless needed
603bb04
refactor: remove proposal id comment
e9241e9
chore: goerli and sepolia deployments
20ef1e6
chore: example sx interaction script
4aeed64
Merge branch 'chore_space_deployer_script' into feat_export_proposal_id
498e0d3
refactor: make salt a constant in example script to reduce local vars
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"ActiveProposalsLimiterProposalValidationStrategy": "0x399821c9Ea977387a0DEcCF1C9692B4dF925FF38", | ||
"AvatarExecutionStrategyImplementation": "0xecE4f6b01a2d7FF5A9765cA44162D453fC455e42", | ||
"CompTimelockCompatibleExecutionStrategyImplementation": "0x91086017D5eAEc4BeEc86ac770b5eE672e4Be589", | ||
"CompVotingStrategy": "0x0c2De612982Efd102803161fc7C74CcA15Db932c", | ||
"EthSigAuthenticator": "0x5f9B7D78c9a37a439D78f801E0E339C6E711e260", | ||
"EthTxAuthenticator": "0xBA06E6cCb877C332181A6867c05c8b746A21Aed1", | ||
"MerkleWhitelistVotingStrategy": "0x34f0AfFF5A739bBf3E285615F50e40ddAaf2A829", | ||
"OZVotesVotingStrategy": "0x2c8631584474E750CEdF2Fb6A904f2e84777Aefe", | ||
"OptimisticCompTimelockCompatibleExecutionStrategyImplementation": "0x77e7Aa43b28Df1e467bd4806fE3bF26F5c3EAD27", | ||
"OptimisticTimelockExecutionStrategyImplementation": "0x49AF19f9318d55ad8e7CE743De9Ce76ED408CE0C", | ||
"PropositionPowerAndActiveProposalsLimiterValidationStrategy": "0x358e4Ba219CC1e1c7084A14c3a504772acfc40b1", | ||
"PropositionPowerProposalValidationStrategy": "0x6D9d6D08EF6b26348Bd18F1FC8D953696b7cf311", | ||
"ProxyFactory": "0x4B4F7f64Be813Ccc66AEFC3bFCe2baA01188631c", | ||
"SpaceImplementation": "0xC3031A7d3326E47D49BfF9D374d74f364B29CE4D", | ||
"TimelockExecutionStrategyImplementation": "0xf2A1C2f2098161af98b2Cc7E382AB7F3ba86Ebc4", | ||
"VanillaAuthenticator": "0xb9BE0a0093933968E3B4c4fC5d939B6c1Fe45142", | ||
"VanillaProposalValidationStrategy": "0x9A39194F870c410633C170889E9025fba2113c79", | ||
"VanillaVotingStrategy": "0xC1245C5DCa7885C73E32294140F1e5d30688c202", | ||
"WhitelistVotingStrategy": "0x3CEE21A33751A2722413fF62dEC3dEc48e7748A4" | ||
} |
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,21 @@ | ||
{ | ||
"ActiveProposalsLimiterProposalValidationStrategy": "0x399821c9Ea977387a0DEcCF1C9692B4dF925FF38", | ||
"AvatarExecutionStrategyImplementation": "0xecE4f6b01a2d7FF5A9765cA44162D453fC455e42", | ||
"CompTimelockCompatibleExecutionStrategyImplementation": "0x91086017D5eAEc4BeEc86ac770b5eE672e4Be589", | ||
"CompVotingStrategy": "0x0c2De612982Efd102803161fc7C74CcA15Db932c", | ||
"EthSigAuthenticator": "0x5f9B7D78c9a37a439D78f801E0E339C6E711e260", | ||
"EthTxAuthenticator": "0xBA06E6cCb877C332181A6867c05c8b746A21Aed1", | ||
"MerkleWhitelistVotingStrategy": "0x34f0AfFF5A739bBf3E285615F50e40ddAaf2A829", | ||
"OZVotesVotingStrategy": "0x2c8631584474E750CEdF2Fb6A904f2e84777Aefe", | ||
"OptimisticCompTimelockCompatibleExecutionStrategyImplementation": "0x77e7Aa43b28Df1e467bd4806fE3bF26F5c3EAD27", | ||
"OptimisticTimelockExecutionStrategyImplementation": "0x49AF19f9318d55ad8e7CE743De9Ce76ED408CE0C", | ||
"PropositionPowerAndActiveProposalsLimiterValidationStrategy": "0x358e4Ba219CC1e1c7084A14c3a504772acfc40b1", | ||
"PropositionPowerProposalValidationStrategy": "0x6D9d6D08EF6b26348Bd18F1FC8D953696b7cf311", | ||
"ProxyFactory": "0x4B4F7f64Be813Ccc66AEFC3bFCe2baA01188631c", | ||
"SpaceImplementation": "0xC3031A7d3326E47D49BfF9D374d74f364B29CE4D", | ||
"TimelockExecutionStrategyImplementation": "0xf2A1C2f2098161af98b2Cc7E382AB7F3ba86Ebc4", | ||
"VanillaAuthenticator": "0xb9BE0a0093933968E3B4c4fC5d939B6c1Fe45142", | ||
"VanillaProposalValidationStrategy": "0x9A39194F870c410633C170889E9025fba2113c79", | ||
"VanillaVotingStrategy": "0xC1245C5DCa7885C73E32294140F1e5d30688c202", | ||
"WhitelistVotingStrategy": "0x3CEE21A33751A2722413fF62dEC3dEc48e7748A4" | ||
} |
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,118 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.18; | ||
|
||
import { Script } from "forge-std/Script.sol"; | ||
|
||
import { ProxyFactory } from "../src/ProxyFactory.sol"; | ||
import { Space } from "../src/Space.sol"; | ||
import { VanillaAuthenticator } from "../src/authenticators/VanillaAuthenticator.sol"; | ||
import { TimelockExecutionStrategy } from "../src/execution-strategies/timelocks/TimelockExecutionStrategy.sol"; | ||
import { Strategy, IndexedStrategy, InitializeCalldata, Choice, MetaTransaction } from "../src/types.sol"; | ||
import { Enum } from "@gnosis.pm/safe-contracts/contracts/common/Enum.sol"; | ||
|
||
// Example script to deploy a space, create a proposal, vote on it, and execute it. | ||
contract Example is Script { | ||
// Paste in the addresses from your json in the /deployments/ folder. The below are from v1.0.2 on goerli. | ||
address public proxyFactory = address(0x4B4F7f64Be813Ccc66AEFC3bFCe2baA01188631c); | ||
address public spaceImplementation = address(0xd9c46d5420434355d0E5Ca3e3cCb20cE7A533964); | ||
address public vanillaVotingStrategy = address(0xC1245C5DCa7885C73E32294140F1e5d30688c202); | ||
address public vanillaProposalValidationStrategy = address(0x9A39194F870c410633C170889E9025fba2113c79); | ||
address public vanillaAuthenticator = address(0xb9BE0a0093933968E3B4c4fC5d939B6c1Fe45142); | ||
address public timelockExecutionStrategyImplementation = address(0xdD5243b799759e2C64bD6CaFD7e57FcbB676f87D); | ||
|
||
// Change the salt to deploy multiple spaces or get a 'salt already used' error | ||
uint256 public constant saltNonce = 1234; | ||
|
||
function run() public { | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
address deployer = address(0x2842c82E20ab600F443646e1BC8550B44a513D82); | ||
|
||
Strategy[] memory votingStrategies = new Strategy[](1); | ||
votingStrategies[0] = Strategy(vanillaVotingStrategy, new bytes(0)); | ||
|
||
string[] memory votingStrategyMetadataURIs = new string[](1); | ||
votingStrategyMetadataURIs[0] = ""; | ||
|
||
address[] memory authenticators = new address[](1); | ||
authenticators[0] = vanillaAuthenticator; | ||
|
||
string memory proposalValidationStrategyMetadataURI = ""; | ||
string memory daoURI = ""; | ||
string memory metadataURI = ""; | ||
|
||
// Deploy space | ||
ProxyFactory(proxyFactory).deployProxy( | ||
spaceImplementation, | ||
abi.encodeWithSelector( | ||
Space.initialize.selector, | ||
InitializeCalldata( | ||
deployer, | ||
0, | ||
0, | ||
100, | ||
Strategy(vanillaProposalValidationStrategy, new bytes(0)), | ||
proposalValidationStrategyMetadataURI, | ||
daoURI, | ||
metadataURI, | ||
votingStrategies, | ||
votingStrategyMetadataURIs, | ||
authenticators | ||
) | ||
), | ||
saltNonce | ||
); | ||
|
||
address space = ProxyFactory(proxyFactory).predictProxyAddress( | ||
spaceImplementation, | ||
keccak256(abi.encodePacked(deployer, saltNonce)) | ||
); | ||
|
||
// Deploy Execution Strategy with the space whitelisted | ||
address[] memory spacesWhitelist = new address[](1); | ||
spacesWhitelist[0] = space; | ||
ProxyFactory(proxyFactory).deployProxy( | ||
timelockExecutionStrategyImplementation, | ||
abi.encodeWithSelector( | ||
TimelockExecutionStrategy.setUp.selector, | ||
abi.encode(deployer, deployer, spacesWhitelist, 0, 0) | ||
), | ||
saltNonce | ||
); | ||
|
||
address timelockExecutionStrategy = ProxyFactory(proxyFactory).predictProxyAddress( | ||
timelockExecutionStrategyImplementation, | ||
keccak256(abi.encodePacked(deployer, saltNonce)) | ||
); | ||
|
||
// Create proposal | ||
MetaTransaction[] memory proposalTransactions = new MetaTransaction[](1); | ||
// Example proposal tx | ||
proposalTransactions[0] = MetaTransaction(deployer, 0, abi.encode("hello"), Enum.Operation.Call, 0); | ||
VanillaAuthenticator(vanillaAuthenticator).authenticate( | ||
space, | ||
Space.propose.selector, | ||
abi.encode( | ||
deployer, | ||
"", | ||
Strategy(timelockExecutionStrategy, abi.encode(proposalTransactions)), | ||
new bytes(0) | ||
) | ||
); | ||
|
||
// Cast vote | ||
IndexedStrategy[] memory userVotingStrategies = new IndexedStrategy[](1); | ||
userVotingStrategies[0] = IndexedStrategy(0, new bytes(0)); | ||
VanillaAuthenticator(vanillaAuthenticator).authenticate( | ||
space, | ||
Space.vote.selector, | ||
abi.encode(deployer, 1, Choice.For, userVotingStrategies, "") | ||
); | ||
|
||
// Execute proposal, which queues it in the tx in timelock | ||
Space(space).execute(1, abi.encode(proposalTransactions)); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we specify in the doc that there's an unused param ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the natspec comments?