Skip to content

Commit

Permalink
Refactored sample proposals
Browse files Browse the repository at this point in the history
Change governor in governanceDecisions to timelock
Updated Readme
  • Loading branch information
rubydog committed Apr 30, 2021
1 parent 6fe6dfb commit 66d2454
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 2,302 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,24 @@ The project deploys to Ropsten via Infura. A secrets-example.js file is included

```bash
npx hardhat run --network ropsten deploy
```

## Sample proposals

`sample-proposals` directory contains few examples of how to create proposals. Below is one such example of creating proposal.

#### **`proposal.json`**
```json
{
"targets": ["0xf61E0C9d284508C284ba5d8a2eB2829581974E43"],
"values": ["0"],
"signatures": ["transfer(address,uint256)"],
"callDatas": ["0x000000000000000000000000d22506fbcb0fc301459ca8adddbd82c2895d1ccf00000000000000000000000000000000000000000000000000000000004c4b40"],
"description": "sample description"
}
```

Create above proposal by running following script
```bash
HARDHAT_NETWORK=ropsten PRIVATE_KEY=your-key node ./createNewProposal.js ./proposal.json
```
24 changes: 24 additions & 0 deletions createNewProposal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const network = process.env.HARDHAT_NETWORK
const hre = require("hardhat");
const ethers = hre.ethers;
const GovernorAlpha = require(`./deployments/${network}/GovernorAlpha.json`)
const proposal = require(process.argv[2])

async function main() {

const provider = ethers.providers.getDefaultProvider(network);
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
const contract = new ethers.Contract(GovernorAlpha.address, GovernorAlpha.abi, wallet);

await contract.propose(proposal.targets, proposal.values, proposal.signatures, proposal.callDatas, proposal.description, {gasPrice: 20000000000, gasLimit: 7600000})
}

main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});



2 changes: 1 addition & 1 deletion deploy/01_deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = async ({
console.log('Deploying GovernanceDecisions');
const governanceDecisions = await deploy('GovernanceDecisions',{
from: deployer,
args: [governorAlphaAddress]
args: [timelock.address]
});
console.log("GovernanceDecisions deployed to: ", governanceDecisions.address);
};
7 changes: 7 additions & 0 deletions sample-proposals/addFoundationMember.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"targets": ["0x2349E4DaFFa5F78E2cb4Ff46FBB193d614230Dc7"],
"values": ["0"],
"signatures": ["addFoundationMember(string)"],
"callDatas": ["0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d4268757368616e204c6f64686100000000000000000000000000000000000000"],
"description": "sample description"
}
Loading

0 comments on commit 66d2454

Please sign in to comment.