Skip to content

Commit 98040ee

Browse files
author
Malteish
authored
Merge pull request #335 from corpus-io/feature/deploy2gnosis
Feature/deploy2gnosis
2 parents 6b3d4cc + b6b6210 commit 98040ee

File tree

6 files changed

+170
-69
lines changed

6 files changed

+170
-69
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,22 @@ In order to improve UX, though, a frontend will be offered. In order to improve
7272

7373
Several of the contracts implement [EIP-2771](https://eips.ethereum.org/EIPS/eip-2771), and therefore use a trusted forwarder. The forwarder will be set in the constructor and there is no way to change it after deployment. The forwarder used will be the openGSN v2 forwarder deployed on mainnet. Some information about this contract:
7474

75-
- [Documentation and addresses](https://docs-v2.opengsn.org/networks/ethereum/mainnet.html)
75+
- [Documentation and addresses](https://docs-v2.opengsn.org/)
7676
- [Code](https://github.com/opengsn/gsn/blob/v2.2.5/packages/contracts/src/forwarder/Forwarder.sol)
7777
- [Audit reports](https://docs-v2.opengsn.org/audits.html)
78-
- Deployment: **0xAa3E82b4c4093b4bA13Cb5714382C99ADBf750cA**
78+
- Deployment on Ethereum Mainnet: **0xAa3E82b4c4093b4bA13Cb5714382C99ADBf750cA**
79+
7980
- deployed 2022-04-21
81+
- [official resources](https://docs-v2.opengsn.org/networks/xdai/xdai.html)
8082
- Visit on [etherscan](https://etherscan.io/address/0xaa3e82b4c4093b4ba13cb5714382c99adbf750ca) ([see transactions here](https://etherscan.io/txsInternal?a=0xAa3E82b4c4093b4bA13Cb5714382C99ADBf750cA&&m=advanced&p=1))
8183
- This [dashboard](https://dune.com/oren/meta-transactions-on-ethereum-over-time) lists the forwarder as second most active forwarder contract with over 2000 transactions executed
8284
- used in our [tests](./test/CrowdinvestingERC2771.t.sol).
8385

86+
- Deployment on Gnosis Chain: **0x7eEae829DF28F9Ce522274D5771A6Be91d00E5ED**
87+
- deployed 2021-04-29
88+
- [official resources](https://docs-v2.opengsn.org/networks/xdai/xdai.html)
89+
- visit on [blockscout](https://gnosis.blockscout.com/address/0x7eEae829DF28F9Ce522274D5771A6Be91d00E5ED)
90+
8491
The platform will maintain a hot wallet (EOA) in order to send transactions to the forwarder contract. This results in the following flow:
8592

8693
- contract A supports EIP-2771 and uses `forwarder` as its (one and only, immutable) trusted forwarder

docs/deployment.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ forge script script/DeployToken.s.sol --rpc-url $GOERLI_RPC_URL --verify --broa
5353
## Forwarder
5454

5555
If the forwarder has not been deployed yet, e.g. when working in a testing environment, it can be deployed like this:
56-
`forge create node_modules/@opengsn/contracts/src/forwarder/Forwarder.sol:Forwarder --private-key $PRIVATE_KEY --rpc-url $GOERLI_RPC_URL --verify --etherscan-api-key $ETHERSCAN_API_KEY`
56+
57+
```
58+
forge create node_modules/@opengsn/contracts/src/forwarder/Forwarder.sol:Forwarder --private-key $PRIVATE_KEY --rpc-url $GOERLI_RPC_URL --verify --etherscan-api-key $ETHERSCAN_API_KEY
59+
```
5760

5861
## Contract Verification
5962

@@ -120,3 +123,27 @@ Provide the constructor arguments separated by whitespace in a file like this:
120123
```
121124

122125
More info can be found [here](https://book.getfoundry.sh/reference/forge/forge-verify-contract).
126+
127+
#### Verify on Gnosis Chiado
128+
129+
Use these settings for the Chiado network:
130+
131+
```
132+
forge [... deployment commands ...] --rpc-url $CHIADO_RPC_URL --verify --verifier blockscout --verifier-url https://gnosis-chiado.blockscout.com/api?
133+
```
134+
135+
#### Verify on Gnosis Mainnet
136+
137+
- blockscout
138+
139+
```
140+
forge script script/DeployPlatform.s.sol:DeployPlatform --private-key $PRIVATE_KEY --rpc-url $GNOSIS_RPC_URL --verify --verifier blockscout --verifier-url https://gnosis.blockscout.com/api? --resume
141+
```
142+
143+
Note that the URL provided in the output will point to gnosisscan, but that is wrong. The verification only happens on blockscout.
144+
145+
- gnosisscan (requires a gnosisscan api key):
146+
147+
```
148+
forge script script/DeployPlatform.s.sol:DeployPlatform --private-key $PRIVATE_KEY --rpc-url $GNOSIS_RPC_URL --verify --etherscan-api-key $GNOSISSCAN_API_KEY --resume
149+
```

docs/deployments.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Deployments
2+
3+
## Production
4+
5+
The contracts are deployed to these production networks:
6+
7+
- Ethereum Mainnet
8+
- [Gnosis Chain](https://www.gnosis.io/)
9+
10+
These are the most relevant contracts. Those that we deployed were verified on blockscout and gnosisscan, as both explorers seem to be used by the community.
11+
12+
| Contract | Ethereum Mainnet | Gnosis Chain (fomerly xDai chain) | | Comment |
13+
| -------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------- | ------- |
14+
| Forwarder | | [0x7eEae829DF28F9Ce522274D5771A6Be91d00E5ED](https://gnosis.blockscout.com/address/0x7eEae829DF28F9Ce522274D5771A6Be91d00E5ED) | These were deployed by the GSN team |
15+
| FeeSettingsCloneFactory | | [0x2659B6c5121049626363dBc1d22f267e79a0BFDE](https://gnosisscan.io/address/0x2659b6c5121049626363dbc1d22f267e79a0bfde) | |
16+
| AllowListCloneFactory | | [0x2b27853251fcEc49617f7a3E2C9809108CCC36d6](https://gnosisscan.io/address/0x2b27853251fcec49617f7a3e2c9809108ccc36d6) | |
17+
| TokenProxyFactory | | [0x994257AcCF99E5995F011AB2A3025063e5367629](https://gnosisscan.io/address/0x994257accf99e5995f011ab2a3025063e5367629) | |
18+
| VestingCloneFactory | | [0xCCC45E788bcf916b3b7cA79c2e1A1fC694aD03F7](https://gnosisscan.io/address/0xccc45e788bcf916b3b7ca79c2e1a1fc694ad03f7) | |
19+
| PrivateOfferFactory | | [0x66330A3718F68c293046d39498EDC6a043CF7190](https://gnosisscan.io/address/0x66330a3718f68c293046d39498edc6a043cf7190) | |
20+
| FeeSettings | | [0xFce9A1e8C063162f4F54f84ab8B2744D3Efc15A2](https://gnosisscan.io/address/0xFce9A1e8C063162f4F54f84ab8B2744D3Efc15A2) | |
21+
| AllowList | | [0xf2c479836b1f23eBE127CFB3B6dabf535d60B6DD](https://gnosisscan.io/address/0xf2c479836b1f23ebe127cfb3b6dabf535d60b6dd) |
22+
| CrowdinvestingCloneFactory | | [0x470586e0a7c2E641c39930B96E58E4300Be32cF3](https://gnosisscan.io/address/0x470586e0a7c2e641c39930b96e58e4300be32cf3) | | |
23+
| monerium | | [0xcB444e90D8198415266c6a2724b7900fb12FC56E](https://gnosis.blockscout.com/token/0xcB444e90D8198415266c6a2724b7900fb12FC56E) | these were deployed by the monerium team |
24+
25+
## Testing
26+
27+
The contracts are deployed to these testing networks:
28+
29+
- Sepolia
30+
- [Chiado](https://docs.gnosischain.com/concepts/networks/chiado)
31+
32+
| Contract | Sepolia | Chiado | | Comment |
33+
| -------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | ------- |
34+
| Forwarder | | [0x2659B6c5121049626363dBc1d22f267e79a0BFDE](https://gnosis-chiado.blockscout.com/address/0x2659B6c5121049626363dBc1d22f267e79a0BFDE) | |
35+
| FeeSettingsCloneFactory | | [0xf2c479836b1f23eBE127CFB3B6dabf535d60B6DD](https://blockscout.chiadochain.net/address/0xf2c479836b1f23ebe127cfb3b6dabf535d60b6dd) | |
36+
| AllowListCloneFactory | | [0xCCC45E788bcf916b3b7cA79c2e1A1fC694aD03F7](https://blockscout.chiadochain.net/address/0xccc45e788bcf916b3b7ca79c2e1a1fc694ad03f7) | |
37+
| TokenProxyFactory | | [0x470586e0a7c2E641c39930B96E58E4300Be32cF3](https://blockscout.chiadochain.net/address/0x470586e0a7c2e641c39930b96e58e4300be32cf3) | |
38+
| VestingCloneFactory | | [0x2CC672eac7326DC0c3E19d1B313548346Eb10FD8](https://blockscout.chiadochain.net/address/0x2cc672eac7326dc0c3e19d1b313548346eb10fd8) | |
39+
| PrivateOfferFactory | | [0x994257AcCF99E5995F011AB2A3025063e5367629](https://blockscout.chiadochain.net/address/0x994257accf99e5995f011ab2a3025063e5367629) | |
40+
| FeeSettings | | [0xab32D71F81CB897C17C9474059466bF7e117384c](https://blockscout.chiadochain.net/address/0xab32D71F81CB897C17C9474059466bF7e117384c) | |
41+
| AllowList | | [0x774AE1a25964A0DbA498Ff7b7B59B2877B0F5be6](https://blockscout.chiadochain.net/address/0x774ae1a25964a0dba498ff7b7b59b2877b0f5be6) |
42+
| CrowdinvestingCloneFactory | | [0x53B5E6Acd59021E61495AbD30796b09A25c880eD](https://blockscout.chiadochain.net/address/0x53b5e6acd59021e61495abd30796b09a25c880ed) | |
43+
| tokenize.it_USDC | | [0xC3Ea9c8BF307c7022670C88dF0357E28DA975267](https://blockscout.chiadochain.net/address/0xc3ea9c8bf307c7022670c88df0357e28da975267) | |
44+
| tokenize.it_EUROC | | [0x730653cEB98334937431e27be111369a90B9aCc7](https://blockscout.chiadochain.net/address/0x730653ceb98334937431e27be111369a90b9acc7) | |
45+
| monerium | | [0xb106ed7587365a16b6691a3D4B2A734f4E8268a2](https://gnosis-chiado.blockscout.com/address/0xb106ed7587365a16b6691a3D4B2A734f4E8268a2) | these were deployed by the monerium team |
46+
47+
On chiado, the platform cold wallet is a simple EOA with this address: 0x99b686F27413fd41F338aDD3Bce2eb60bBa7885E.

foundry.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ optimizer_runs = 10_000
1414
gas_reports = ["AllowList", "Crowdinvesting", "FeeSettings", "PrivateOffer", "PrivateOfferFactory", "Token"]
1515

1616
[rpc_endpoints]
17-
goerli = "${GOERLI_RPC_URL}"
17+
goerli = "${GOERLI_RPC_URL}"
18+
chiado = "${CHIADO_RPC_URL}"
19+
gnosis = "${GNOSIS_RPC_URL}"

hardhat.config.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,13 @@ const config: HardhatUserConfig = {
5555
localhost: {
5656
url: 'http://localhost:8545',
5757
},
58-
ropsten: {
59-
url: process.env.ROPSTEN_URL || '',
58+
chiado: {
59+
url: process.env.CHIADO_RPC_URL || '',
60+
accounts:
61+
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
62+
},
63+
gnosis: {
64+
url: process.env.GNOSIS_RPC_URL || '',
6065
accounts:
6166
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
6267
},

script/DeployPlatform.s.sol

Lines changed: 76 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ contract DeployPlatform is Script {
1818
function run() public {
1919
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
2020
address deployerAddress = vm.addr(deployerPrivateKey);
21-
address platformColdWallet = 0x9E23f8AA17B2721cf69D157b8a15bd7b64ac881C; // Sepolia and Mainnet
2221

2322
/*
2423
* config
@@ -36,84 +35,98 @@ contract DeployPlatform is Script {
3635
// trustedCurrencies[5] = address(0xcB444e90D8198415266c6a2724b7900fb12FC56E); // EURe
3736

3837
// Mainnet
39-
address trustedForwarder = 0xAa3E82b4c4093b4bA13Cb5714382C99ADBf750cA;
40-
address[] memory trustedCurrencies = new address[](6);
41-
trustedCurrencies[0] = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); // WEth
42-
trustedCurrencies[1] = address(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599); // WBTC
43-
trustedCurrencies[2] = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); // USDC
44-
trustedCurrencies[3] = address(0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c); // EUROC
45-
trustedCurrencies[4] = address(0x6B175474E89094C44Da98b954EedeAC495271d0F); // DAI
46-
trustedCurrencies[5] = address(0x3231Cb76718CDeF2155FC47b5286d82e6eDA273f); // EURe
38+
// address platformColdWallet = 0x9E23f8AA17B2721cf69D157b8a15bd7b64ac881C;
39+
// address trustedForwarder = 0xAa3E82b4c4093b4bA13Cb5714382C99ADBf750cA;
40+
// address[] memory trustedCurrencies = new address[](6);
41+
// trustedCurrencies[0] = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); // WEth
42+
// trustedCurrencies[1] = address(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599); // WBTC
43+
// trustedCurrencies[2] = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); // USDC
44+
// trustedCurrencies[3] = address(0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c); // EUROC
45+
// trustedCurrencies[4] = address(0x6B175474E89094C44Da98b954EedeAC495271d0F); // DAI
46+
// trustedCurrencies[5] = address(0x3231Cb76718CDeF2155FC47b5286d82e6eDA273f); // EURe
4747

4848
// Sepolia
49+
// address platformColdWallet = 0x9E23f8AA17B2721cf69D157b8a15bd7b64ac881C;
4950
// address trustedForwarder = 0x274ca5f21Cdde06B6E4Fe063f5087EB6Cf3eAe55;
5051
// address[] memory trustedCurrencies = new address[](2);
5152
// trustedCurrencies[0] = address(0x30627856Ef668F0A6a1ca9145C9538f7d5b42BDE); // tEUROC
5253
// trustedCurrencies[1] = address(0x86f488C7CC923d987b246994a0E5e20B3364fd92); // tUSDC
5354

55+
// Gnosis Chiado
56+
// address platformColdWallet = 0x99b686F27413fd41F338aDD3Bce2eb60bBa7885E;
57+
// address trustedForwarder = 0x2659B6c5121049626363dBc1d22f267e79a0BFDE;
58+
// address[] memory trustedCurrencies = new address[](6);
59+
// trustedCurrencies[0] = address(0xb106ed7587365a16b6691a3D4B2A734f4E8268a2); // Monerium
60+
61+
// Gnosis Mainnet
62+
address platformColdWallet = 0x9E23f8AA17B2721cf69D157b8a15bd7b64ac881C;
63+
address trustedForwarder = 0x7eEae829DF28F9Ce522274D5771A6Be91d00E5ED;
64+
address[] memory trustedCurrencies = new address[](6);
65+
trustedCurrencies[0] = address(0xcB444e90D8198415266c6a2724b7900fb12FC56E); // Monerium
66+
5467
/*
5568
* execution
5669
*/
5770
console.log("Deployer address: ", deployerAddress);
5871
vm.startBroadcast(deployerPrivateKey);
5972

60-
// console.log("Deploying FeeSettingsCloneFactory contract...");
61-
// FeeSettings feeSettingsLogicContract = new FeeSettings(trustedForwarder);
62-
// FeeSettingsCloneFactory feeSettingsCloneFactory = new FeeSettingsCloneFactory(
63-
// address(feeSettingsLogicContract)
64-
// );
65-
// console.log("FeeSettingsCloneFactory deployed at: ", address(feeSettingsCloneFactory));
66-
67-
// console.log("Deploying FeeSettings contract...");
68-
// Fees memory fees = Fees(200, 600, 200, 0);
69-
// FeeSettings feeSettings = FeeSettings(
70-
// feeSettingsCloneFactory.createFeeSettingsClone(
71-
// bytes32(0),
72-
// trustedForwarder,
73-
// platformColdWallet,
74-
// fees,
75-
// platformColdWallet,
76-
// platformColdWallet,
77-
// platformColdWallet
78-
// )
79-
// );
80-
// console.log("FeeSettings deployed at: ", address(feeSettings));
81-
82-
// console.log("Deploying AllowListCloneFactory contract...");
83-
// AllowList allowListLogicContract = new AllowList(trustedForwarder);
84-
// AllowListCloneFactory allowListCloneFactory = new AllowListCloneFactory(address(allowListLogicContract));
85-
// console.log("AllowListCloneFactory deployed at: ", address(allowListCloneFactory));
86-
87-
// console.log("Deploying AllowList contract...");
88-
89-
// uint256[] memory attributes = new uint256[](trustedCurrencies.length);
90-
// for (uint256 i = 0; i < trustedCurrencies.length; i++) {
91-
// attributes[i] = TRUSTED_CURRENCY;
92-
// }
93-
// AllowList allowList = AllowList(
94-
// allowListCloneFactory.createAllowListClone(
95-
// bytes32(0),
96-
// trustedForwarder,
97-
// platformColdWallet,
98-
// trustedCurrencies,
99-
// attributes
100-
// )
101-
// );
102-
// console.log("Allowlist deployed at: ", address(allowList));
73+
console.log("Deploying FeeSettingsCloneFactory contract...");
74+
FeeSettings feeSettingsLogicContract = new FeeSettings(trustedForwarder);
75+
FeeSettingsCloneFactory feeSettingsCloneFactory = new FeeSettingsCloneFactory(
76+
address(feeSettingsLogicContract)
77+
);
78+
console.log("FeeSettingsCloneFactory deployed at: ", address(feeSettingsCloneFactory));
79+
80+
console.log("Deploying FeeSettings contract...");
81+
Fees memory fees = Fees(200, 600, 200, 0);
82+
FeeSettings feeSettings = FeeSettings(
83+
feeSettingsCloneFactory.createFeeSettingsClone(
84+
bytes32(0),
85+
trustedForwarder,
86+
platformColdWallet,
87+
fees,
88+
platformColdWallet,
89+
platformColdWallet,
90+
platformColdWallet
91+
)
92+
);
93+
console.log("FeeSettings deployed at: ", address(feeSettings));
94+
95+
console.log("Deploying AllowListCloneFactory contract...");
96+
AllowList allowListLogicContract = new AllowList(trustedForwarder);
97+
AllowListCloneFactory allowListCloneFactory = new AllowListCloneFactory(address(allowListLogicContract));
98+
console.log("AllowListCloneFactory deployed at: ", address(allowListCloneFactory));
99+
100+
console.log("Deploying AllowList contract...");
101+
102+
uint256[] memory attributes = new uint256[](trustedCurrencies.length);
103+
for (uint256 i = 0; i < trustedCurrencies.length; i++) {
104+
attributes[i] = TRUSTED_CURRENCY;
105+
}
106+
AllowList allowList = AllowList(
107+
allowListCloneFactory.createAllowListClone(
108+
bytes32(0),
109+
trustedForwarder,
110+
platformColdWallet,
111+
trustedCurrencies,
112+
attributes
113+
)
114+
);
115+
console.log("Allowlist deployed at: ", address(allowList));
103116

104-
// console.log("Deploying VestingCloneFactory contract...");
105-
// Vesting vestingImplementation = Vesting(0xa740Dd991655b2887321C71D8Ac0c171a0C9E969);
106-
// VestingCloneFactory vestingCloneFactory = new VestingCloneFactory(address(vestingImplementation));
107-
// console.log("VestingCloneFactory deployed at: ", address(vestingCloneFactory));
117+
console.log("Deploying VestingCloneFactory contract...");
118+
Vesting vestingImplementation = Vesting(0xa740Dd991655b2887321C71D8Ac0c171a0C9E969);
119+
VestingCloneFactory vestingCloneFactory = new VestingCloneFactory(address(vestingImplementation));
120+
console.log("VestingCloneFactory deployed at: ", address(vestingCloneFactory));
108121

109-
// console.log("Deploying PrivateOfferFactory contract...");
110-
// PrivateOfferFactory privateOfferFactory = new PrivateOfferFactory(vestingCloneFactory);
111-
// console.log("PrivateOfferFactory deployed at: ", address(privateOfferFactory));
122+
console.log("Deploying PrivateOfferFactory contract...");
123+
PrivateOfferFactory privateOfferFactory = new PrivateOfferFactory(vestingCloneFactory);
124+
console.log("PrivateOfferFactory deployed at: ", address(privateOfferFactory));
112125

113-
// console.log("Deploying TokenProxyFactory contract...");
114-
// Token tokenImplementation = new Token(trustedForwarder);
115-
// TokenProxyFactory tokenProxyFactory = new TokenProxyFactory(address(tokenImplementation));
116-
// console.log("TokenProxyFactory deployed at: ", address(tokenProxyFactory));
126+
console.log("Deploying TokenProxyFactory contract...");
127+
Token tokenImplementation = new Token(trustedForwarder);
128+
TokenProxyFactory tokenProxyFactory = new TokenProxyFactory(address(tokenImplementation));
129+
console.log("TokenProxyFactory deployed at: ", address(tokenProxyFactory));
117130

118131
// console.log("Deploying Tokens to use as currrency on testnet...");
119132
// Token tUSDC = Token(

0 commit comments

Comments
 (0)