You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> We recommend you run within the provided [devcontainer](https://code.visualstudio.com/remote/advancedcontainers/overview) to ensure you have all the necessary tooling installed such `zksync-cli`, and `forge`.
7
9
8
10
For subquery utilization refer to [Nodle-zksync-subquery](/subquery/README.md)
9
11
10
12
## Repo organization
11
-
-`./` contains foundry contracts for Nodle and Click on ZkSync:
13
+
14
+
-`./` contains Nodle's constellation of smart contracts, tools and services for L1 Ethereum and L2 ZkSync operations.
12
15
-`./lib` contains libraries we depend on.
13
16
-`./src` contains contract sources.
14
-
-`./script` contains deployment scripts.
17
+
-`./script` contains forge scripts.
18
+
-`./hardhat-deploy` contains typescript deployment scripts compiled and run by hardhat.
15
19
-`./test` contains unit tests.
16
-
-`./subquery` contains a custom subquery for this project.
17
-
- ...more to come
20
+
-`./subquery` contains a custom subquery for this project.
21
+
-`./utils` contains typescript utilities such as batch-register for clk names.
22
+
-`./ops` contains shell scripts for operational tasks like deployment orchestration, maintenance, and chain interaction
18
23
19
24
## Conventions
25
+
20
26
- all files should be licensed under the BSD 3 Clear Clause license with the required file header `// SPDX-License-Identifier: BSD-3-Clause-Clear`
21
27
- when writing scripts, ensure that:
22
28
- input environment variables are prefixed with `N_` to differentiate them from `forge` environment variables
@@ -59,6 +65,7 @@ Please see scripts in `./scripts` and refer to the [forge documentation](https:/
59
65
### Deploying Click contracts
60
66
61
67
Please define the following environment variables:
68
+
62
69
-`N_WHITELIST_ADMIN`: address of the whitelist admin on the paymaster whitelist contract (typically the onboard or sponsorship API address).
63
70
-`N_WITHDRAWER`: address of the account allowed to withdraw ETH from the paymaster contract.
64
71
- deployer address will be set as super admin.
@@ -83,12 +90,14 @@ If you wish to simulate on-chain transactions pass a RPC URL.
83
90
### Deploying ContentSign Enterprise contracts
84
91
85
92
Please define the following environment variables:
93
+
86
94
-`N_NAME`: name of the NFT contract deployed.
87
95
-`N_SYMBOL`: symbol of the NFT contract deployed.
88
96
89
97
Here is a full example for a Sepolia deployment: `N_NAME=ExampleContentSign N_SYMBOL=ECS forge script script/DeployContentSignEnterprise.s.sol --zksync --rpc-url https://sepolia.era.zksync.dev --zk-optimizer -i 1 --broadcast`.
90
98
91
99
Once deployed, the script will output the contract address, and the account you deployed with will be set as the administrator of this contract with the possibility to grant other users minting access. You may onboard a new user with `cast` via the following command template:
100
+
92
101
```shell
93
102
export ETH_RPC_URL=https://sepolia.era.zksync.dev # use the appropriate RPC here
94
103
export NFT=0x195e4E251c41e8Ae9E9E961366C73e2CFbfB115A # use your own contract address here
In the following example `N_VOTER1_ADDR` is the public address of the bridge oracle whose role is going to be a voter for funds coming from
104
-
the parachain side. Similarly `N_VOTER2_ADDR` and `N_VOTER3_ADDR` are addresses of the other two voter oracles.
114
+
the parachain side. Similarly `N_VOTER2_ADDR` and `N_VOTER3_ADDR` are addresses of the other two voter oracles.
105
115
The closer oracle does not need special permissions and thus need not to be mentioned.
106
116
NOTE: `i` flag in the command will make the tool prompt you for the private key of the deployer. So remember to have that handy but you don't need to define it in your environment.
Afterwards the user you onboarded should be able to mint NFTs as usual via the `safeMint(ownerAddress, metadataUri)` function.
115
126
116
127
### Deploying MigrationNFT contract
128
+
117
129
The `MigrationNFT` contract allows the minting of a reward SoulBound NFT when users bridge enough tokens through `NODLMigration`. Users can "level up" depending on the amount of tokens they bring in, with each levels being a sorted list of bridged amounts.
118
130
119
131
You will need to set the following environment variables:
132
+
120
133
-`N_MIGRATION`: address of the `NODLMigration` contract
121
134
-`N_MAX_HOLDERS`: maximum number of participants
122
135
-`N_LEVELS`: number of levels to set
123
136
-`N_LEVELS_x` where `x` is an integer from `0` to `N_LEVELS - 1`: actual number of tokens for each level
124
137
-`N_LEVELS_URI_x` where `x` is an integer from `0` to `N_LEVELS - 1`: actual metadata URL for the NFTs
125
138
126
139
You can then run the script `script/DeployMigrationNFT.s.sol` very similarly to the below:
Given a tracker id (`proposal`) and the bridge address you may run the script available in `./script/CheckBridge.s.sol`. The script will output proposal details and outline expectations as to the proposal's execution timeline. Here is a simple example:
### Whitelisting new users on ContentSign contracts
167
+
151
168
Given a user and contract address, you can whitelist new users on contracts derived from `EnterpriseContentSign` with the `ContentSignWhitelist` script. Note that this assumes your own key has been granted admin permissions on this same contract. Here is a simple example for a testnet contract:
> The below steps are **not** for the faint of heart. Contract verification is technically not supported yet by the zkSync foundry fork, and the instructions below are likely to break (in which case feel free to update them via a PR).
162
180
163
181
Verification on Etherscan is best done via the Solidity Json Input method as it is the least error prone and most reliable. To do so, you will need a few elements:
182
+
164
183
1. Contract address, which you typically get from script outputs.
165
184
2.`solc` and `zksolc` versions, which you can identify based on the pragma header of the solidity contracts, or by checking what binaries are on your system:
In the sample case above, we are using `solc``0.8.23` and `zksolc``1.4.1`.
171
-
3. The Solidity Json Input file, which you can get by following the below instructions
172
-
1. Build the contracts and ask for the `build-info` via `forge build --zksync --zk-optimizer --build-info`
173
-
2. Access the said `build-info` at path `./out/build-info`, you will find there a JSON file (if you have more than one, take the most recent one)
174
-
3. Open the JSON file and select the value under the `input` key
175
-
4. Due to some incompatibilities, normalize the JSON value by removing the keys `settings.metadata` and `settings.viaIR`
176
-
4. The contract inputs, which you can regenerate if you know the input values you deployed the contract with. Or that you can fetch by viewing your deployment transaction on [explorer.zksync.io](https://explorer.zksync.io). To do, you will need to:
177
-
1. Open your deployment transaction on [explorer.zksync.io](https://explorer.zksync.io) (make sure to select the testnet if you are using the zkSync Era testnet)
178
-
2. Look for the input data variable named `_input`
179
-
3. Copy paste its value and **strip the `0x prefix** as Etherscan will throw an error otherwise
In the sample case above, we are using `solc``0.8.23` and `zksolc``1.4.1`. 3. The Solidity Json Input file, which you can get by following the below instructions
192
+
193
+
1. Build the contracts and ask for the `build-info` via `forge build --zksync --zk-optimizer --build-info`
194
+
2. Access the said `build-info` at path `./out/build-info`, you will find there a JSON file (if you have more than one, take the most recent one)
195
+
3. Open the JSON file and select the value under the `input` key
196
+
4. Due to some incompatibilities, normalize the JSON value by removing the keys `settings.metadata` and `settings.viaIR`
197
+
5. The contract inputs, which you can regenerate if you know the input values you deployed the contract with. Or that you can fetch by viewing your deployment transaction on [explorer.zksync.io](https://explorer.zksync.io). To do, you will need to:
198
+
6. Open your deployment transaction on [explorer.zksync.io](https://explorer.zksync.io) (make sure to select the testnet if you are using the zkSync Era testnet)
199
+
7. Look for the input data variable named `_input`
200
+
8. Copy paste its value and **strip the `0x prefix** as Etherscan will throw an error otherwise
180
201
181
202
Use all these artifacts on the contract verification page on Etherscan for your given contract (open your contract on Etherscan, select `Contract` and the link starting with `Verify`). When prompted, enter the compiler versions, the license (we use BSD-3 Clause Clear). Then on the next page, enter your normalized JSON input file, and the contract constructor inputs.
0 commit comments