Skip to content

Commit

Permalink
67: implementation of erc20 token voting
Browse files Browse the repository at this point in the history
- update abis
- fix whitespace
- README.md
- tests cleanup
- documentation update
- update constant lib
- forge install: openzeppelin-contracts
- use tokenId for erc20 receipt
- transfer meta ownership in proposal creator for ProposalBuilder script
- upgrade TestNet rather than deploy again
  • Loading branch information
jac18281828 committed May 9, 2023
1 parent 0cd7ad7 commit a759ff1
Show file tree
Hide file tree
Showing 34 changed files with 1,073 additions and 79 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ jobs:
run: |
export DEPLOYED_LIBRARY=$(bin/library.py Constant.sol.json)
echo "Using library ${DEPLOYED_LIBRARY}"
forge script ./script/DeployCommunityBuilder.sol --sig 'deploy()' --libraries ${DEPLOYED_LIBRARY} --slow --broadcast --rpc-url ${RPC_URL} --private-key ${PRIVATE_KEY} --etherscan-api-key ${ETHERSCAN_API_KEY} --verify || true
forge script ./script/DeployCollective.sol --sig 'deploy()' --libraries ${DEPLOYED_LIBRARY} --slow --broadcast --rpc-url ${RPC_URL} --private-key ${PRIVATE_KEY} --etherscan-api-key ${ETHERSCAN_API_KEY} --verify || true
BUILDER_ADDRESS=0x4ba7E0dc43180Cb10EF53FF9Da923E02f459Ec9F forge script ./script/DeployCommunityBuilder.sol --sig 'upgrade()' --libraries ${DEPLOYED_LIBRARY} --slow --broadcast --rpc-url ${RPC_URL} --private-key ${PRIVATE_KEY}
BUILDER_ADDRESS=0xe1a13ea37F2BFE35B612799fcf9eBD43efA00B87 forge script ./script/DeployCollective.sol --sig 'upgrade()' --libraries ${DEPLOYED_LIBRARY} --slow --broadcast --rpc-url ${RPC_URL} --private-key ${PRIVATE_KEY}
6 changes: 5 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
branch = v1.5.3
branch = v1.5.3
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
branch = v4.8.3
20 changes: 10 additions & 10 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
"options": {
"cwd": "${workspaceFolder}",
"env": {
"CONSTANT_LIB_ADDRESS": "0x5a7D758870C57d8A4E1AB309079705E77D279D0a"
"CONSTANT_LIB_ADDRESS": "0xb72FB606aF07D03f9D3075F72f7705F1148A5450"
}
},
"dependsOn": "test",
Expand All @@ -152,7 +152,7 @@
"options": {
"cwd": "${workspaceFolder}",
"env": {
"CONSTANT_LIB_ADDRESS": "0x5a7D758870C57d8A4E1AB309079705E77D279D0a",
"CONSTANT_LIB_ADDRESS": "0xb72FB606aF07D03f9D3075F72f7705F1148A5450",
"BUILDER_ADDRESS": "0x2b3FbC7371Bc6DE55D314Bd0D74E08A3E2c9dbE9"
}
},
Expand All @@ -169,7 +169,7 @@
"options": {
"cwd": "${workspaceFolder}",
"env": {
"CONSTANT_LIB_ADDRESS": "0x5a7D758870C57d8A4E1AB309079705E77D279D0a",
"CONSTANT_LIB_ADDRESS": "0xb72FB606aF07D03f9D3075F72f7705F1148A5450",
"CLASS_PROXY": "0x0Ee183DEA88Be769fD1CAb473fDaCdd16791163A",
"TARGET_PROTOTYPE": "0xe7879fdb66b6107709502D2ad362fa43BC278DbE"
}
Expand All @@ -187,7 +187,7 @@
"options": {
"cwd": "${workspaceFolder}",
"env": {
"CONSTANT_LIB_ADDRESS": "0x5a7D758870C57d8A4E1AB309079705E77D279D0a"
"CONSTANT_LIB_ADDRESS": "0xb72FB606aF07D03f9D3075F72f7705F1148A5450"
}
},
"dependsOn": "test",
Expand All @@ -203,7 +203,7 @@
"options": {
"cwd": "${workspaceFolder}",
"env": {
"CONSTANT_LIB_ADDRESS": "0x5a7D758870C57d8A4E1AB309079705E77D279D0a",
"CONSTANT_LIB_ADDRESS": "0xb72FB606aF07D03f9D3075F72f7705F1148A5450",
"BUILDER_ADDRESS": "0xA117420676c6Ff31b7126cBE8fdC752Eb9A1602c"
}
},
Expand All @@ -220,10 +220,10 @@
"options": {
"cwd": "${workspaceFolder}",
"env": {
"CONSTANT_LIB_ADDRESS": "0x5a7D758870C57d8A4E1AB309079705E77D279D0a",
"GOVERNANCE_ADDRESS": "0x0089699e6391011991f6ffe2e36bb3d745a2ba65",
"STORAGE_ADDRESS": "0xe0bfa34b0beb30853489c67c8172f4c64eb8c43b",
"META_ADDRESS": "0x46e0f484a22a2e091b524b7495b45b2583f69846"
"CONSTANT_LIB_ADDRESS": "0xb72FB606aF07D03f9D3075F72f7705F1148A5450",
"GOVERNANCE_ADDRESS": "0x6b5b3b287a80742d728511f51638315cf1987977",
"STORAGE_ADDRESS": "0xc28ea107f64746ac90349c6c09c193d966f1ca91",
"META_ADDRESS": "0xd75fa6c5c3fdfd495d851c43e5331e16a058902a"
}
},
"dependsOn": "test",
Expand All @@ -239,7 +239,7 @@
"options": {
"cwd": "${workspaceFolder}",
"env": {
"CONSTANT_LIB_ADDRESS": "0x5a7D758870C57d8A4E1AB309079705E77D279D0a",
"CONSTANT_LIB_ADDRESS": "0xb72FB606aF07D03f9D3075F72f7705F1148A5450",
"BUILDER_ADDRESS": "",
"GOVERNANCE_ADDRESS": "0xa2f50e55ac910ba030b3e4cab92da8de5b38ef2d",
"STORAGE_ADDRESS": "0xe0c76c1621738b870eac5a37447fdadc8c077c21",
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2022, collective
Copyright (c) 2022-2023, collective
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Collective Governance has been designed from the ground up to be very easy to us
| Contract | Ethereum Address | Version |
| ----------------- | ------------------------------------------ | ------- |
| Constant | 0xD5DA9B812806E080948476A801d2004f3305E63F | 0.9.8 |
| CommunityBuilder | 0x4ba7E0dc43180Cb10EF53FF9Da923E02f459Ec9F | 0.9.8 |
| GovernanceBuilder | 0xe1a13ea37F2BFE35B612799fcf9eBD43efA00B87 | 0.9.8 |
| CommunityBuilder | 0x4ba7E0dc43180Cb10EF53FF9Da923E02f459Ec9F | LATEST |
| GovernanceBuilder | 0xe1a13ea37F2BFE35B612799fcf9eBD43efA00B87 | LATEST |

#### Görli TestNet

Expand All @@ -51,13 +51,13 @@ Collective Governance has been designed from the ground up to be very easy to us

### VS Code

Using the Remote module in VSCode simply reopen the project in it's container.
Using the Remote module in VSCode simply reopen the project in it's container.

`Reopen in Container`

### Foundry

This project is using [Foundry](https://github.com/foundry-rs/foundry). Development is enabled with the [Foundry Development](https://github.com/collectivexyz/foundry/pkgs/container/foundry) container
This project is using [Foundry](https://github.com/foundry-rs/foundry). Development is enabled with the [Foundry Development](https://github.com/collectivexyz/foundry) container

### JavaScript API

Expand Down
57 changes: 55 additions & 2 deletions abi/CommunityBuilder.json
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
{
"indexed": false,
"internalType": "address",
"name": "projectClassFactory",
"name": "tokenClassFactory",
"type": "address"
}
],
Expand Down Expand Up @@ -378,7 +378,7 @@
{
"indexed": false,
"internalType": "address",
"name": "projectClassFactory",
"name": "tokenClassFactory",
"type": "address"
},
{
Expand Down Expand Up @@ -443,6 +443,30 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "project",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenThreshold",
"type": "uint256"
}
],
"name": "asClosedErc20Community",
"outputs": [
{
"internalType": "contract CommunityBuilder",
"name": "",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand All @@ -467,6 +491,25 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "project",
"type": "address"
}
],
"name": "asErc20Community",
"outputs": [
{
"internalType": "contract CommunityBuilder",
"name": "",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -536,6 +579,11 @@
"internalType": "address",
"name": "_project",
"type": "address"
},
{
"internalType": "address",
"name": "_token",
"type": "address"
}
],
"name": "initialize",
Expand Down Expand Up @@ -633,6 +681,11 @@
"name": "_project",
"type": "address"
},
{
"internalType": "address",
"name": "_token",
"type": "address"
},
{
"internalType": "uint8",
"name": "_version",
Expand Down
2 changes: 1 addition & 1 deletion contracts/Constant.sol
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ library Constant {
uint256 public constant MAXIMUM_REBATE_BASE_FEE = 200 gwei;

/// software versions
uint32 public constant CURRENT_VERSION = 3;
uint32 public constant CURRENT_VERSION = 4;

/// @notice Compute the length of any string in solidity
/// @dev This method is expensive and is used only for validating
Expand Down
6 changes: 6 additions & 0 deletions contracts/ProposalBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ import { Transaction, TransactionCollection } from "../contracts/collection/Tran
import { Storage } from "../contracts/storage/Storage.sol";
import { MetaStorage } from "../contracts/storage/MetaStorage.sol";

/**
* @notice ProposalBuilder is designed to help building up on-chain proposals. One of the features
* of the ProposalBuilder, like the other builders in this project is it remembers the previous settings
* for the build. This makes it easy and cost effective to create multiple proposals because only
* changed information needs to be updated on each build cycle.
*/
contract ProposalBuilder is VersionedContract, ERC165, OwnableInitializable, UUPSUpgradeable, Initializable {
string public constant NAME = "proposal builder";

Expand Down
3 changes: 3 additions & 0 deletions contracts/ProposalBuilderProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy
import { Constant } from "./Constant.sol";
import { ProposalBuilder } from "./ProposalBuilder.sol";

/**
* @notice This contract is intended to act as an upgradeable Proxy for the ProposalBuilder
*/
contract ProposalBuilderProxy is ERC1967Proxy {
constructor(
address _implementation,
Expand Down
Loading

0 comments on commit a759ff1

Please sign in to comment.