Skip to content

Commit

Permalink
feat(networks): add support for Base sepolia (unlock-protocol#13529)
Browse files Browse the repository at this point in the history
* add basic network file

* readme typo

* add verification

* remove unused param

* unlock deploymeny

* etherscan api key

* update base scan api key again

* correct unlock address

* use actual proxy address

* add subgraph

* update readme

* add multisig

* add provider

* Update packages/networks/src/networks/base-sepolia.ts

* use unlock provider

---------

Co-authored-by: Julien Genestoux <julien.genestoux@gmail.com>
  • Loading branch information
2 people authored and blahkheart committed Mar 30, 2024
1 parent cbdfb95 commit fa63c3d
Show file tree
Hide file tree
Showing 8 changed files with 749 additions and 17 deletions.
280 changes: 280 additions & 0 deletions governance/.openzeppelin/unknown-84532.json
@@ -0,0 +1,280 @@
{
"manifestVersion": "3.2",
"proxies": [
{
"address": "0x259813B665C8f6074391028ef782e27B65840d89",
"txHash": "0x00676bcbd95a7de923bb7ada6008a6863a05d9602721c9d355a82274a30be36f",
"kind": "transparent"
}
],
"impls": {
"c6d805c82f3f300da2425695b00fbf12dfe20f45dc8ffdf35ed30d444ccd6d60": {
"address": "0xf98D7ADA874D53a75BbDfB05D2A96C1525d426A7",
"txHash": "0x91d7ba08318d557ee0d725745322ee818f2199c91bd694a64171b296d739320e",
"layout": {
"solcVersion": "0.8.21",
"storage": [
{
"label": "initialized",
"offset": 0,
"slot": "0",
"type": "t_bool",
"contract": "UnlockInitializable",
"src": "contracts/past-versions/UnlockV13.sol:1327"
},
{
"label": "initializing",
"offset": 1,
"slot": "0",
"type": "t_bool",
"contract": "UnlockInitializable",
"src": "contracts/past-versions/UnlockV13.sol:1332"
},
{
"label": "______gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)50_storage",
"contract": "UnlockContextUpgradeable",
"src": "contracts/past-versions/UnlockV13.sol:1406"
},
{
"label": "_owner",
"offset": 0,
"slot": "51",
"type": "t_address",
"contract": "UnlockOwnable",
"src": "contracts/past-versions/UnlockV13.sol:1435"
},
{
"label": "______gap",
"offset": 0,
"slot": "52",
"type": "t_array(t_uint256)50_storage",
"contract": "UnlockOwnable",
"src": "contracts/past-versions/UnlockV13.sol:1501"
},
{
"label": "grossNetworkProduct",
"offset": 0,
"slot": "102",
"type": "t_uint256",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2786"
},
{
"label": "totalDiscountGranted",
"offset": 0,
"slot": "103",
"type": "t_uint256",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2788"
},
{
"label": "locks",
"offset": 0,
"slot": "104",
"type": "t_mapping(t_address,t_struct(LockBalances)3109_storage)",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2791"
},
{
"label": "globalBaseTokenURI",
"offset": 0,
"slot": "105",
"type": "t_string_storage",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2795"
},
{
"label": "globalTokenSymbol",
"offset": 0,
"slot": "106",
"type": "t_string_storage",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2799"
},
{
"label": "publicLockAddress",
"offset": 0,
"slot": "107",
"type": "t_address",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2802"
},
{
"label": "uniswapOracles",
"offset": 0,
"slot": "108",
"type": "t_mapping(t_address,t_contract(IUniswapOracleV3)757)",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2806"
},
{
"label": "weth",
"offset": 0,
"slot": "109",
"type": "t_address",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2809"
},
{
"label": "udt",
"offset": 0,
"slot": "110",
"type": "t_address",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2812"
},
{
"label": "estimatedGasForPurchase",
"offset": 0,
"slot": "111",
"type": "t_uint256",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2815"
},
{
"label": "chainId",
"offset": 0,
"slot": "112",
"type": "t_uint256",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2818"
},
{
"label": "proxyAdminAddress",
"offset": 0,
"slot": "113",
"type": "t_address",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2821"
},
{
"label": "proxyAdmin",
"offset": 0,
"slot": "114",
"type": "t_contract(ProxyAdmin)3095",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2822"
},
{
"label": "_publicLockVersions",
"offset": 0,
"slot": "115",
"type": "t_mapping(t_address,t_uint16)",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2825"
},
{
"label": "_publicLockImpls",
"offset": 0,
"slot": "116",
"type": "t_mapping(t_uint16,t_address)",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2826"
},
{
"label": "publicLockLatestVersion",
"offset": 0,
"slot": "117",
"type": "t_uint16",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2827"
},
{
"label": "protocolFee",
"offset": 0,
"slot": "118",
"type": "t_uint256",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2830"
},
{
"label": "swapBurnerAddress",
"offset": 0,
"slot": "119",
"type": "t_address",
"contract": "Unlock",
"src": "contracts/past-versions/UnlockV13.sol:2833"
}
],
"types": {
"t_address": {
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]",
"numberOfBytes": "1600"
},
"t_bool": {
"label": "bool",
"numberOfBytes": "1"
},
"t_contract(IUniswapOracleV3)757": {
"label": "contract IUniswapOracleV3",
"numberOfBytes": "20"
},
"t_contract(ProxyAdmin)3095": {
"label": "contract ProxyAdmin",
"numberOfBytes": "20"
},
"t_mapping(t_address,t_contract(IUniswapOracleV3)757)": {
"label": "mapping(address => contract IUniswapOracleV3)",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_struct(LockBalances)3109_storage)": {
"label": "mapping(address => struct Unlock.LockBalances)",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_uint16)": {
"label": "mapping(address => uint16)",
"numberOfBytes": "32"
},
"t_mapping(t_uint16,t_address)": {
"label": "mapping(uint16 => address)",
"numberOfBytes": "32"
},
"t_string_storage": {
"label": "string",
"numberOfBytes": "32"
},
"t_struct(LockBalances)3109_storage": {
"label": "struct Unlock.LockBalances",
"members": [
{
"label": "deployed",
"type": "t_bool",
"offset": 0,
"slot": "0"
},
{
"label": "totalSales",
"type": "t_uint256",
"offset": 0,
"slot": "1"
},
{
"label": "yieldedDiscountTokens",
"type": "t_uint256",
"offset": 0,
"slot": "2"
}
],
"numberOfBytes": "96"
},
"t_uint16": {
"label": "uint16",
"numberOfBytes": "2"
},
"t_uint256": {
"label": "uint256",
"numberOfBytes": "32"
}
},
"namespaces": {}
}
}
}
}
26 changes: 21 additions & 5 deletions governance/README.md
Expand Up @@ -23,7 +23,7 @@ yarn workspace @unlock-protocol/networks build

## Add block explorer verification

- add a `<your-network>` key to the `apiKey` object in [`packages/hardhat-helpers/etherscan.js`](/packages/hardhat-helpers/src/etherscan.js)
- add a `<your-network>` key to the `apiKey` object in [`packages/hardhat-helpers/src/etherscan.js`](/packages/hardhat-helpers/src/etherscan.js)
- optionally can add support for env variable

When you are done, rebuild the helpers package with
Expand Down Expand Up @@ -74,9 +74,25 @@ yarn hardhat set:unlock-config

### Deploy the subgraph

First you will need to create a new graph on [The Graph](https://thegraph.com) studio.
1. First you will need to create a new graph on [The Graph studio](https://thegraph.com/studio).

Then the following commands
2. In the `packages/networks/src/<your-network>.ts` config file, fill the `subgraph` object as follow:

```js
subgraph: {
endpoint: '<>', // this is given to you by the graph after deploying
networkName: 'base-sepolia', // the graph name of the network see https://thegraph.com/docs/en/developing/supported-networks/
studioName: 'unlock-protocol-<your-network>', // the name of the graph
},
```

3. Rebuild the networks package

```
yarn workspace @unlock-protocol/networks build
```

4. Deploy the graph by using the following commands

```shell
# got to the subgraph folder
Expand All @@ -85,10 +101,10 @@ cd subgraph
# create the subgraph.yaml and generate the files
yarn build <your-network>

yarn deploy:studio <your-subgraph-name>
yarn deploy <your-subgraph-name>
```

The graph will now sync. In the `packages/networks/src/<your-network>.ts` config file, fill the `subgraph` object with a name in `studioEndpoint` and the API url in `endpoint`.
The graph is now deployed. Add the URL that is shown to the network file.

### Verify contracts

Expand Down
10 changes: 5 additions & 5 deletions packages/hardhat-helpers/src/etherscan.js
Expand Up @@ -16,8 +16,8 @@ const etherscan = {
polygonMumbai: 'W9TVEYKW2CDTQ94T3A2V93IX6U3IHQN5Y3',
avalanche: 'N4AF8AYN8PXY2MFPUT8PAFSZNVJX5Q814X',
celo: '6KBKUFYV3NQR4Y1BQN3Q34S2U7NTZBBPQZ',
baseGoerli: 'YourApiKeyToken',
base: 'F9E5R4E8HIJQZMRE9U9IZMP7NVZ2IAXNB8',
baseSepolia: 'F9E5R4E8HIJQZMRE9U9IZMP7NVZ2IAXNB8',
linea: 'S66J314Q7PICPB4RP2G117KDFQRBEUYIFX',
polygonZkEVM: '8H4ZB9SQBMQ7WA1TCIXFQVCHTVX8DXTY9Y',
scroll: 'BZEXNPN6KKKJQ8VIMNXZDZNEX7QQZWZQ3P',
Expand All @@ -33,11 +33,11 @@ const etherscan = {
},
},
{
network: 'baseGoerli',
chainId: 84531,
network: 'baseSepolia',
chainId: 84532,
urls: {
apiURL: 'https://api-goerli.basescan.org/api',
browserURL: 'https://goerli.basescan.org/',
apiURL: 'https://api-sepolia.basescan.org/api',
browserURL: 'https://sepolia.basescan.org/',
},
},
{
Expand Down

0 comments on commit fa63c3d

Please sign in to comment.