Skip to content

Commit

Permalink
chore: prepare configs for Amoy network (#690)
Browse files Browse the repository at this point in the history
* chore: prepare configs for Amoy network (wip)

* upgrade the Amoy testing protocol addresses and startBlock

* update protocol config for amoy on staging

* remove some remaining Mumbai and replace with Amoy

* fix lint

* declare missing data for ChainId 80002 (Amoy)

* move amoy subgraph from hosted-service to the graph network (tempo)
  • Loading branch information
levalleux-ludo authored Apr 12, 2024
1 parent 861eb93 commit 5bbcaaa
Show file tree
Hide file tree
Showing 73 changed files with 267 additions and 216 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy-staging-subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: npm run build -- --cache-dir=".turbo"
- name: Authenticate The Graph CLI
run: npx graph auth --product hosted-service ${{ secrets.THE_GRAPH_ACCESS_TOKEN_STAGING }}
- name: Deploy subgraph to mumbai
run: cd ./packages/subgraph && npm run deploy:staging
- name: Deploy subgraph to amoy
run: cd ./packages/subgraph && npm run deploy:staging:amoy
- name: Deploy subgraph to sepolia
run: cd ./packages/subgraph && npm run deploy:staging:sepolia
4 changes: 2 additions & 2 deletions .github/workflows/deploy-testing-subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: npm run build -- --cache-dir=".turbo"
- name: Authenticate The Graph CLI
run: npx graph auth --product hosted-service ${{ secrets.THE_GRAPH_ACCESS_TOKEN_TESTING }}
- name: Deploy subgraph to mumbai
run: cd ./packages/subgraph && npm run deploy:testing
- name: Deploy subgraph to amoy
run: cd ./packages/subgraph && npm run deploy:testing:amoy
- name: Deploy subgraph to sepolia
run: cd ./packages/subgraph && npm run deploy:testing:sepolia
8 changes: 4 additions & 4 deletions .github/workflows/pin-to-pinata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ jobs:
INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }}
INFURA_PROJECT_SECRET: ${{ secrets.INFURA_PROJECT_SECRET }}
run: |
echo "Pin for testing/mumbai env..."
echo "Pin for testing/amoy env..."
npm run pin-to-pinata -- \
-e testing \
-c testing-80001-0 \
-c testing-80002-0 \
-fd ${{ env.FROM_DATE }} \
-p ${{ env.PINATA_JWT }} \
-i ${{ env.INFURA_PROJECT_ID }}/${{ env.INFURA_PROJECT_SECRET }}
Expand All @@ -52,10 +52,10 @@ jobs:
-p ${{ env.PINATA_JWT }} \
-i ${{ env.INFURA_PROJECT_ID }}/${{ env.INFURA_PROJECT_SECRET }}
echo "Pin for staging/mumbai env..."
echo "Pin for staging/amoy env..."
npm run pin-to-pinata -- \
-e staging \
-c staging-80001-0 \
-c staging-80002-0 \
-fd ${{ env.FROM_DATE }} \
-p ${{ env.PINATA_JWT }} \
-i ${{ env.INFURA_PROJECT_ID }}/${{ env.INFURA_PROJECT_SECRET }}
Expand Down
9 changes: 6 additions & 3 deletions docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,19 @@ Subgraphs are deployed also to different environments.

Every merge into the `main` branch will trigger a deployment of the subgraph which listens to our `testing` environment. For details have a look at [`.github/workflows/deploy-testing-subgraph.yaml`](../.github/workflows/deploy-testing-subgraph.yaml.). Access this subgraph via:

- https://graph.bsn-development-potassium.bosonportal.io/subgraphs/name/boson/corecomponents
- https://api.thegraph.com/subgraphs/name/bosonprotocol/amoy-testing
- https://api.thegraph.com/subgraphs/name/bosonprotocol/sepolia-testing

### Staging

If a stable release of the packages are triggered through the GitHub UI, then a deployment of the subgraph connected to the `staging` environment is also initiated. For details have a look at [`.github/workflows/deploy-staging-subgraph.yaml`](../.github/workflows/deploy-staging-subgraph.yaml.). Access this subgraph via:

- https://api.thegraph.com/subgraphs/name/bosonprotocol/mumbai
- https://api.thegraph.com/subgraphs/name/bosonprotocol/amoy-staging
- https://api.thegraph.com/subgraphs/name/bosonprotocol/sepolia-staging

### Production

A `production` subgraph deployment to can be triggered through the GitHub UI by running the workflow `deploy-prod-subgraph.yaml`. For details have a look at [`.github/workflows/deploy-prod-subgraph.yaml`](../.github/workflows/deploy-prod-subgraph.yaml.). Access this subgraph via:

- TODO
- https://api.thegraph.com/subgraphs/name/bosonprotocol/polygon
- https://api.thegraph.com/subgraphs/name/bosonprotocol/ethereum
2 changes: 1 addition & 1 deletion packages/common/src/chains.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const chains = {
31337: 31337,
80001: 80001,
80002: 80002,
137: 137,
1: 1,
11155111: 11155111
Expand Down
54 changes: 27 additions & 27 deletions packages/common/src/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,30 @@ export const envConfigs: Record<EnvironmentType, ProtocolConfig[]> = {
testing: [
{
envName: "testing",
chainId: 80001,
configId: "testing-80001-0",
chainId: 80002,
configId: "testing-80002-0",
sellersBlackList:
"https://raw.githubusercontent.com/BAppLimited/curationLists/main/bosonApp.io/testing-80001-0/sellers/blacklist.json",
defaultDisputeResolverId: "13",
defaultTokens: chainIdToDefaultTokens.get(80001),
nativeCoin: chainIdToInfo.get(80001),
getTxExplorerUrl: chainIdToGraphTx.get(80001),
"https://raw.githubusercontent.com/BAppLimited/curationLists/main/bosonApp.io/testing-80002-0/sellers/blacklist.json",
defaultDisputeResolverId: "1",
defaultTokens: chainIdToDefaultTokens.get(80002),
nativeCoin: chainIdToInfo.get(80002),
getTxExplorerUrl: chainIdToGraphTx.get(80002),
subgraphUrl:
"https://api.thegraph.com/subgraphs/name/bosonprotocol/mumbai-testing",
"https://api.studio.thegraph.com/query/71250/llx-amoy-testing/v0.0.1",
jsonRpcUrl:
"https://polygon-mumbai.infura.io/v3/b832a48b9bce4aa6bd9da86eb0126300",
"https://polygon-amoy.infura.io/v3/b832a48b9bce4aa6bd9da86eb0126300",
theGraphIpfsUrl: "https://api.thegraph.com/ipfs/api/v0",
ipfsMetadataUrl: "https://ipfs.infura.io:5001",
contracts: {
protocolDiamond: "0x76051FC05Ab42D912a737d59a8711f1446712630",
forwarder: "0x69015912AA33720b842dCD6aC059Ed623F28d9f7" // https://docs-gasless.biconomy.io/misc/contract-addresses
protocolDiamond: "0x7de418a7ce94debd057c34ebac232e7027634ade",
forwarder: "0xd240234dacd7ffdca7e4effcf6c7190885d7e2f0" // https://github.com/bosonprotocol/boson-protocol-contracts/blob/main/scripts/config/client-upgrade.js#L11
},
metaTx: {
relayerUrl: "https://api.biconomy.io",
forwarderAbi: abis.BiconomyForwarderABI
},
lens: {
...(chainIdToLensInfo.has(80001) && chainIdToLensInfo.get(80001))
...(chainIdToLensInfo.has(80002) && chainIdToLensInfo.get(80002))
}
},
{
Expand All @@ -87,8 +87,8 @@ export const envConfigs: Record<EnvironmentType, ProtocolConfig[]> = {
ipfsMetadataUrl: "https://ipfs.infura.io:5001",
contracts: {
// from https://github.com/bosonprotocol/boson-protocol-contracts/pull/807
protocolDiamond: "0x7de418a7ce94debd057c34ebac232e7027634ade",
forwarder: "0xffffffffffffffffffffffffffffffffffffffff" // https://docs-gasless.biconomy.io/misc/contract-addresses
protocolDiamond: "0x76051fc05ab42d912a737d59a8711f1446712630",
forwarder: "0xbdeA59c8801658561a16fF58D68FC2b198DE4E93" // https://github.com/bosonprotocol/boson-protocol-contracts/blob/main/scripts/config/client-upgrade.js#L10
},
metaTx: undefined,
lens: undefined
Expand All @@ -97,30 +97,30 @@ export const envConfigs: Record<EnvironmentType, ProtocolConfig[]> = {
staging: [
{
envName: "staging",
chainId: 80001,
configId: "staging-80001-0",
chainId: 80002,
configId: "staging-80002-0",
sellersBlackList:
"https://raw.githubusercontent.com/BAppLimited/curationLists/main/bosonApp.io/staging-80001-0/sellers/blacklist.json",
defaultDisputeResolverId: "2",
defaultTokens: chainIdToDefaultTokens.get(80001),
nativeCoin: chainIdToInfo.get(80001),
getTxExplorerUrl: chainIdToGraphTx.get(80001),
"https://raw.githubusercontent.com/BAppLimited/curationLists/main/bosonApp.io/staging-80002-0/sellers/blacklist.json",
defaultDisputeResolverId: "1",
defaultTokens: chainIdToDefaultTokens.get(80002),
nativeCoin: chainIdToInfo.get(80002),
getTxExplorerUrl: chainIdToGraphTx.get(80002),
subgraphUrl:
"https://api.thegraph.com/subgraphs/name/bosonprotocol/mumbai-staging",
"https://api.studio.thegraph.com/query/71250/llx-amoy-staging/v0.0.1",
jsonRpcUrl:
"https://polygon-mumbai.infura.io/v3/b832a48b9bce4aa6bd9da86eb0126300",
"https://polygon-amoy.infura.io/v3/b832a48b9bce4aa6bd9da86eb0126300",
theGraphIpfsUrl: "https://api.thegraph.com/ipfs/api/v0",
ipfsMetadataUrl: "https://ipfs.infura.io:5001",
contracts: {
protocolDiamond: "0xf9719c7e641964D83cC50ea2d4d0D4e6C300d50E",
forwarder: "0x69015912AA33720b842dCD6aC059Ed623F28d9f7"
protocolDiamond: "0x26f643746cbc918b46c2d47edca68c4a6c98ebe6",
forwarder: "0xd240234dacd7ffdca7e4effcf6c7190885d7e2f0" // https://github.com/bosonprotocol/boson-protocol-contracts/blob/main/scripts/config/client-upgrade.js#L11
},
metaTx: {
relayerUrl: "https://api.biconomy.io",
forwarderAbi: abis.BiconomyForwarderABI
},
lens: {
...(chainIdToLensInfo.has(80001) && chainIdToLensInfo.get(80001))
...(chainIdToLensInfo.has(80002) && chainIdToLensInfo.get(80002))
}
},
{
Expand All @@ -142,7 +142,7 @@ export const envConfigs: Record<EnvironmentType, ProtocolConfig[]> = {
contracts: {
// from https://github.com/bosonprotocol/boson-protocol-contracts/pull/807
protocolDiamond: "0x26f643746cbc918b46c2d47edca68c4a6c98ebe6",
forwarder: "0xffffffffffffffffffffffffffffffffffffffff" // https://docs-gasless.biconomy.io/misc/contract-addresses
forwarder: "0xbdeA59c8801658561a16fF58D68FC2b198DE4E93" // https://github.com/bosonprotocol/boson-protocol-contracts/blob/main/scripts/config/client-upgrade.js#L10
},
metaTx: undefined,
lens: undefined
Expand Down
72 changes: 30 additions & 42 deletions packages/common/src/mappings.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChainId, Lens, ProtocolConfig, Token } from "./types";

export const chainIdToInfo = new Map<ChainId, ProtocolConfig["nativeCoin"]>([
[80001, { decimals: "18", name: "Matic", symbol: "MATIC" }],
[80002, { decimals: "18", name: "Matic", symbol: "MATIC" }],
[137, { decimals: "18", name: "Matic", symbol: "MATIC" }],
[1, { decimals: "18", name: "Ether", symbol: "ETH" }],
[11155111, { decimals: "18", name: "sETH", symbol: "sETH" }],
Expand All @@ -13,12 +13,12 @@ export const chainIdToGraphTx = new Map<
(txHash?: string, isAddress?: boolean) => string
>([
[
80001,
80002,
(txHash = "", isAddress = false) => {
if (isAddress) {
return `https://mumbai.polygonscan.com/address/${txHash}`;
return `https://www.oklink.com/amoy/address/${txHash}`;
}
return `https://mumbai.polygonscan.com/tx/${txHash}`;
return `https://www.oklink.com/amoy/tx/${txHash}`;
}
],
[
Expand Down Expand Up @@ -53,18 +53,6 @@ export const chainIdToGraphTx = new Map<

// https://docs.lens.xyz/docs/deployed-contract-addresses
export const chainIdToLensInfo = new Map<ChainId, Lens>([
[
80001,
{
LENS_HUB_CONTRACT: "0x60Ae865ee4C725cd04353b5AAb364553f56ceF82",
LENS_PERIPHERY_CONTRACT: "0xD5037d72877808cdE7F669563e9389930AF404E8",
LENS_PROFILES_CONTRACT_ADDRESS:
"0x60ae865ee4c725cd04353b5aab364553f56cef82",
LENS_PROFILES_CONTRACT_PARTIAL_ABI:
'[{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":true,"name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event","signature":"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"}]',
apiLink: "https://api-mumbai.lens.dev/"
}
],
[
137,
{
Expand Down Expand Up @@ -98,44 +86,44 @@ export const chainIdToDefaultTokens = new Map<ChainId, Token[]>([
]
],
[
80001,
80002,
[
{
symbol: "MATIC",
name: "MATIC",
address: "0x0000000000000000000000000000000000000000",
decimals: "18"
},
{
symbol: "WETH",
name: "Wrapped Ether",
address: "0xA6FA4fB5f76172d178d61B04b0ecd319C5d1C0aa",
decimals: "18"
},
// {
// symbol: "WETH",
// name: "Wrapped Ether",
// address: "0x????????????????????????????????????????", // TODO: to be defined
// decimals: "18"
// },
{
symbol: "BOSON",
name: "Boson Token (PoS)",
address: "0x1f5431E8679630790E8EbA3a9b41d1BB4d41aeD0",
address: "0x94e32c4bfcA1D3fe08B6F8252ABB47A5B14AC2bD",
decimals: "18"
},
{
symbol: "USDC",
name: "Mumbai USD Coin",
address: "0xe6b8a5CF854791412c1f6EFC7CAf629f5Df1c747",
decimals: "6"
},
{
symbol: "DAI",
name: "DAI",
address: "0x001b3b4d0f3714ca98ba10f6042daebf0b1b7b6f",
decimals: "18"
},
{
symbol: "USDT",
name: "Tether USD",
address: "0xA02f6adc7926efeBBd59Fd43A84f4E0c0c91e832",
decimals: "6"
}
// {
// symbol: "USDC",
// name: "Amoy USD Coin",
// address: "0x????????????????????????????????????????", // TODO: to be defined
// decimals: "6"
// },
// {
// symbol: "DAI",
// name: "DAI",
// address: "0x????????????????????????????????????????", // TODO: to be defined
// decimals: "18"
// },
// {
// symbol: "USDT",
// name: "Tether USD",
// address: "0x????????????????????????????????????????", // TODO: to be defined
// decimals: "6"
// }
]
],
[
Expand Down
4 changes: 2 additions & 2 deletions packages/common/src/types/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export type ChainId = (typeof chains)[keyof typeof chains];

export type ConfigId =
| "local-31337-0"
| "testing-80001-0"
| "testing-80002-0"
| "testing-11155111-0"
| "staging-80001-0"
| "staging-80002-0"
| "staging-11155111-0"
| "production-137-0"
| "production-1-0";
Expand Down
2 changes: 1 addition & 1 deletion packages/common/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe("index entrypoint", () => {
}
);

test.each([1, 137, 80001, 11155111])(
test.each([1, 137, 80002, 11155111])(
`Chain Id %p is available`,
(chainId) => {
expect(chains[chainId]).toBeTruthy();
Expand Down
1 change: 1 addition & 0 deletions packages/core-sdk/src/native-meta-tx/tokenSpecifics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const _tokenSpecifics: Record<number, Record<string, TokenSpecifics>> = {
ERC712_VERSION: "2" // On MUMBAI, ERC712_VERSION is different than on Polygon
}
}
// TODO: check on Amoy
};

/** Returns the configuration items that are specific to some tokens on some chain */
Expand Down
6 changes: 0 additions & 6 deletions packages/core-sdk/src/subgraph/mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ const DELAYS_PER_CHAINID: {
MAX_SAME_BLOCK_DELAY: 5000,
DEFAULT_TIMEOUT: 30000
},
80001: {
BLOCK_DELAY: 1000,
MAX_SAME_BLOCK: 20,
MAX_SAME_BLOCK_DELAY: 5000,
DEFAULT_TIMEOUT: 30000
},
80002: {
BLOCK_DELAY: 1000,
MAX_SAME_BLOCK: 20,
Expand Down
4 changes: 2 additions & 2 deletions packages/core-sdk/src/utils/tokenInfoManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export const NATIVE_TOKENS: { [key: number]: ITokenInfo } = {
decimals: 18,
symbol: "MATIC"
},
80001: {
// Polygon Mumbai
80002: {
// Polygon Amoy
name: "MATIC",
decimals: 18,
symbol: "MATIC"
Expand Down
4 changes: 2 additions & 2 deletions packages/core-sdk/tests/core-sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("#fromDefaultConfig()", () => {
const coreSDK = CoreSDK.fromDefaultConfig({
web3Lib: new MockWeb3LibAdapter(),
envName: "testing",
configId: "testing-80001-0"
configId: "testing-80002-0"
});
expect(coreSDK).toBeInstanceOf(CoreSDK);
});
Expand All @@ -27,7 +27,7 @@ describe("#fromDefaultConfig()", () => {
CoreSDK.fromDefaultConfig({
web3Lib: new MockWeb3LibAdapter(),
envName: "unknown" as EnvironmentType,
configId: "testing-80001-0"
configId: "testing-80002-0"
})
).toThrow();
});
Expand Down
2 changes: 1 addition & 1 deletion packages/core-sdk/tests/errors/decodeErrors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ beforeEach(() => {
coreSDK = CoreSDK.fromDefaultConfig({
web3Lib: new MockWeb3LibAdapter(),
envName: "testing",
configId: "testing-80001-0"
configId: "testing-80002-0"
});
expect(coreSDK).toBeInstanceOf(CoreSDK);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function CommitSuccess({ onHouseClick, exchangeId, commitHash }: Props) {
}}
>
View on{" "}
{[80001, 137].includes(config.chainId)
{[80002, 137].includes(config.chainId)
? "Polygonscan"
: "Etherscan"}{" "}
<ArrowSquareUpRight
Expand Down
Loading

0 comments on commit 5bbcaaa

Please sign in to comment.