Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit e41df54

Browse files
authored
Merge pull request #131 from sygmaprotocol/mmuftic/add-dynamic-list-of-domains
feature: add dynamic list of domains and update testnet
2 parents 10eac62 + d152d58 commit e41df54

18 files changed

+1609
-188
lines changed

Diff for: .github/workflows/check.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- uses: actions/setup-node@v3
2222
with:
2323
cache: yarn
24-
node-version: 16
24+
node-version: 18
2525
- run: yarn install --frozen-lockfile
2626
- run: yarn typecheck
2727
- run: yarn spellcheck

Diff for: dictionary.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -359,4 +359,6 @@ Chainbridge-core
359359
tokenized
360360
MPC-based
361361
Explainers
362-
Chainlist
362+
Chainlist
363+
SupportedDomains
364+
src

Diff for: docs/02-sygma-sdk/03-Quick-Start/07-Examples/01-Basic-ERC-20-Token-Transfers/01-EVM-EVM-example.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ draft: false
99

1010
### EVM-to-EVM token transfer example
1111

12-
In the following example, we will use the `TESTNET` environment to perform a cross-chain ERC-20 transfer with 5 `ERC20LRTST` tokens. The transfer will be initiated on the EVM-side via the Goerli Ethereum testnet and received on the EVM-side via the Sepolia Ethereum testnet.
12+
In the following example, we will use the `TESTNET` environment to perform a cross-chain ERC-20 transfer with 5 `ERC20LRTST` tokens. The transfer will be initiated on the EVM-side via the Mumbai testnet and received on the EVM-side via the Sepolia Ethereum testnet.
1313

1414
This is an example script that demonstrates the functionality of the Sygma SDK and the wider Sygma ecosystem of relayers and bridge and handler contracts. The complete example can be found in this [repo](
1515
https://github.com/sygmaprotocol/sygma-sdk/tree/main/examples/evm-to-evm-fungible-transfer).
@@ -21,7 +21,7 @@ Before running the script, ensure that you have the following:
2121
- Node.js v18
2222
- Yarn (version 3.4.1 or higher)
2323
- The [exported private key](https://support.metamask.io/hc/en-us/articles/360015289632-How-to-export-an-account-s-private-key) of your development wallet
24-
- [Goerli ETH](https://goerlifaucet.com/) for gas
24+
- [Mumbai](https://mumbaifaucet.com/) for gas
2525
- An Ethereum [provider](https://www.infura.io/) (in case the hardcoded RPC within the script does not work)
2626
- A development wallet funded with `ERC20LRTest` tokens from the [Sygma faucet](https://faucet-ui-stage.buildwithsygma.com/) (you can use the UI below; please allow some time for minting as testnet may be congested)
2727

@@ -87,7 +87,7 @@ cd examples/evm-to-evm-fungible-transfer
8787
yarn run transfer
8888
```
8989

90-
The example will use `ethers` in conjunction with the sygma-sdk to create a transfer from Goerli to Sepolia with the `ERC20LRTST` token. It will be received on Sepolia as the `ERC20LRTST` token.
90+
The example will use `ethers` in conjunction with the sygma-sdk to create a transfer from Mumbai to Sepolia with the `ERC20LRTST` token. It will be received on Sepolia as the `ERC20LRTST` token.
9191

9292
### Script functionality
9393

@@ -127,7 +127,7 @@ export async function erc20Transfer(): Promise<void> {
127127
128128
```ts
129129
const provider = new providers.JsonRpcProvider(
130-
"https://rpc.goerli.eth.gateway.fm/" // use your own provider in case this does not work
130+
"https://polygon-mumbai-pokt.nodies.app" // use your own provider in case this does not work
131131
);
132132
const wallet = new Wallet(
133133
privateKey as string,

Diff for: docs/02-sygma-sdk/03-Quick-Start/07-Examples/01-Basic-ERC-20-Token-Transfers/02-EVM-Substrate-example.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ draft: false
99

1010
### EVM-to-Substrate token transfer example
1111

12-
In the following example, we will use the `TESTNET` environment to perform a cross-chain ERC-20 transfer with 0.5 Goerli Phala `gPHA` tokens. The transfer will be initiated on the EVM-side via the Goerli Ethereum testnet and received on the Substrate-side via the Rococo-Phala testnet.
12+
In the following example, we will use the `TESTNET` environment to perform a cross-chain ERC-20 transfer with 0.5 Sepolia sygUSD `sygUSD` tokens. The transfer will be initiated on the EVM-side via the Sepolia Ethereum testnet and received on the Substrate-side via the Rococo-Phala testnet.
1313

1414
This is an example script that demonstrates the functionality of the Sygma SDK and the wider Sygma ecosystem of relayers and bridge and handler contracts/pallets. The complete example can be found in this [repo](
1515
https://github.com/sygmaprotocol/sygma-sdk/tree/main/examples/evm-to-substrate-fungible-transfer#sygma-sdk-erc20-example).
@@ -22,9 +22,9 @@ Before running the script, ensure that you have the following:
2222
- Yarn (version 3.4.1 or higher)
2323
- The [exported private key](https://support.metamask.io/hc/en-us/articles/360015289632-How-to-export-an-account-s-private-key) of your development wallet
2424
- A Substrate wallet to receive tokens into (the example presets an existing wallet address already)
25-
- [Goerli ETH](https://goerlifaucet.com/) for gas
25+
- [Sepolia ETH](https://sepoliafaucet.com/) for gas
2626
- An Ethereum [provider](https://www.infura.io/) (in case the hardcoded RPC within the script does not work)
27-
- A development wallet funded with `gPHA` tokens from the [Sygma faucet](https://faucet-ui-stage.buildwithsygma.com/)
27+
- A development wallet funded with `sygUSD` tokens from the [Sygma faucet](https://faucet-ui-stage.buildwithsygma.com/)
2828

2929
<div style={{ textAlign: 'center' }}>
3030
<iframe
@@ -90,7 +90,7 @@ cd examples/evm-to-substrate-fungible-transfer
9090
yarn run transfer
9191
```
9292

93-
The example will use `ethers` in conjunction with the sygma-sdk to create a transfer from Goerli to Rococo-Phala with a `gPHA` token. It will be received on Rococo-Phala as the native `PHA` token.
93+
The example will use `ethers` in conjunction with the sygma-sdk to create a transfer from Sepolia to Rococo-Phala with a `sygUSD` token. It will be received on Rococo-Phala as the `sygUSD` token.
9494

9595
### Script functionality
9696

@@ -105,7 +105,7 @@ import { Wallet, providers } from "ethers";
105105
const ROCOCO_PHALA_CHAIN_ID = 5231;
106106
const DESTINATION_ADDRESS = "5CDQJk6kxvBcjauhrogUc9B8vhbdXhRscp1tGEUmniryF1Vt"; // replace this value for your preferred Substrate address
107107
const RESOURCE_ID =
108-
"0x0000000000000000000000000000000000000000000000000000000000001000"; // This is the resource ID for the gPHA token according to Sygma's testnet environment
108+
"0x0000000000000000000000000000000000000000000000000000000000001100"; // This is the resource ID for the sygUSD token according to Sygma's testnet environment
109109
```
110110

111111
- Configures the dotenv module and sets the `privateKey` as a value to be pulled from the `.env` file.
@@ -131,7 +131,7 @@ export async function erc20Transfer(): Promise<void> {
131131
132132
```ts
133133
const provider = new providers.JsonRpcProvider(
134-
"https://rpc.goerli.eth.gateway.fm/" // use your own provider in case this does not work
134+
"https://rpc.sepolia.eth.gateway.fm/" // use your own provider in case this does not work
135135
);
136136
const wallet = new Wallet(
137137
privateKey as string,
@@ -149,7 +149,7 @@ export async function erc20Transfer(): Promise<void> {
149149
ROCOCO_PHALA_CHAIN_ID,
150150
DESTINATION_ADDRESS,
151151
RESOURCE_ID,
152-
"500000000000000000" // 18 decimal places, so in this case, 0.5 gPHA tokens
152+
"500000" // 6 decimal places, so in this case, 0.5 sygUSD tokens
153153
);
154154
```
155155

Diff for: docs/02-sygma-sdk/03-Quick-Start/07-Examples/01-Basic-ERC-20-Token-Transfers/03-Substrate-EVM-example.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ draft: false
99

1010
### EVM-to-Substrate token transfer example
1111

12-
In the following example, we will use the `TESTNET` environment to perform a cross-chain ERC-20 transfer with 0.5 Goerli Phala `gPHA` tokens. The transfer will be initiated on the Substrate-side via the Rococo-Phala testnet and received on the EVM-side via the Goerli Ethereum testnet.
12+
In the following example, we will use the `TESTNET` environment to perform a cross-chain ERC-20 transfer with 0.5 sygUSD `sygUSD` tokens. The transfer will be initiated on the Substrate-side via the Rococo-Phala testnet and received on the EVM-side via the Sepolia Ethereum testnet.
1313

1414
This is an example script that demonstrates the functionality of the Sygma SDK and the wider Sygma ecosystem of relayers and bridge and handler contracts/pallets. The complete example can be found in this [repo](https://github.com/sygmaprotocol/sygma-sdk/tree/main/examples/substrate-to-evm-fungible-transfer).
1515

@@ -22,7 +22,7 @@ Before running the script, ensure that you have the following:
2222
- The 12-word mnemonic for your Substrate development wallet
2323
- An Ethereum wallet to receive tokens into (the example presets an existing wallet address already)
2424
- A Substrate provider (in case the hardcoded WSS within the script does not work)
25-
- A Substrate development wallet funded with `PHA` tokens; you will need to run the [EVM-to-Substrate example](02-EVM-Substrate-example.md) first to preload `PHA` tokens into a Substrate wallet
25+
- A Substrate development wallet funded with `sygUSD` tokens; you will need to run the [EVM-to-Substrate example](02-EVM-Substrate-example.md) first to preload `sygUSD` tokens into a Substrate wallet
2626

2727
:::danger
2828
We make use of the dotenv module to manage Substrate's private mnemonics with environment variables. Please note that accidentally committing a .env file containing private mnemonics to a wallet with real funds, onto GitHub, could result in the complete loss of your funds. **Never expose your private keys.**
@@ -81,7 +81,7 @@ cd examples/substrate-to-evm-fungible-transfer
8181
yarn run transfer
8282
```
8383

84-
The example will use `@polkadot/keyring` in conjunction with the sygma-sdk to create a transfer from Rococo-Phala to Goerli with the `PHA` token. It will be received on Goerli as a `gPHA` token.
84+
The example will use `@polkadot/keyring` in conjunction with the sygma-sdk to create a transfer from Rococo-Phala to Sepolia with the `sygUSD` token. It will be received on Sepolia as a `sygUSD` token.
8585

8686
### Script functionality
8787

@@ -96,8 +96,8 @@ import { cryptoWaitReady } from "@polkadot/util-crypto";
9696
import { Environment, Substrate, getTransferStatusData } from "@buildwithsygma/sygma-sdk-core";
9797

9898
const { SubstrateAssetTransfer } = Substrate;
99-
const GOERLI_CHAIN_ID = 5;
100-
const RESOURCE_ID = "0x0000000000000000000000000000000000000000000000000000000000001000"; // This is the resource ID for the gPHA token according to Sygma's testnet environment
99+
const SEPOLIA_CHAIN_ID = 11155111;
100+
const RESOURCE_ID = "0x0000000000000000000000000000000000000000000000000000000000001100"; // This is the resource ID for the sygUSD token according to Sygma's testnet environment
101101
const recipient = "0xD31E89feccCf6f2DE10EaC92ADffF48D802b695C"; // replace this value for your preferred EVM address
102102
```
103103

@@ -174,10 +174,10 @@ const getStatus = async (
174174
```ts
175175
const transfer = assetTransfer.createFungibleTransfer(
176176
account.address,
177-
GOERLI_CHAIN_ID,
177+
SEPOLIA_CHAIN_ID,
178178
recipient,
179179
RESOURCE_ID,
180-
"500000000000" // 12 decimal places, so in this case 0.5 gPHA tokens
180+
"500000000000000000" // 18 decimal places, so in this case 0.5 sygUSD tokens
181181
);
182182
const fee = await assetTransfer.getFee(transfer);
183183
const transferTx = assetTransfer.buildTransferTransaction(transfer, fee);

Diff for: docs/02-sygma-sdk/03-Quick-Start/07-Examples/02-GMP-Examples/04-GMP-Example-With-A-Simple-Storage-Contract.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ draft: false
99

1010
### GMP Example With A Simple Storage Contract
1111

12-
In the following example, we will use the `TESTNET` environment to pass a generic message from Ethereum Sepolia to Ethereum Goerli using a simple storage contract. Specifically, the `deposit` method will be called on Sepolia, passing the details of the function to be called (the `store` function, or function signature `0xa271ced2`) on a smart contract deployed on Goerli "[0xdFA5621F95675D37248bAc9e536Aab4D86766663](https://goerli.etherscan.io/address/0xdFA5621F95675D37248bAc9e536Aab4D86766663)". The method will encode the current UNIX timestamp as the payload to be passed and stored in the destination chain contract. The data can be read by calling the `retrieve` function on the destination chain contract by querying the depositor address derived from the private key.
12+
In the following example, we will use the `TESTNET` environment to pass a generic message from Ethereum Sepolia to Polygon Mumbai using a simple storage contract. Specifically, the `deposit` method will be called on Sepolia, passing the details of the function to be called (the `store` function, or function signature `0xa271ced2`) on a smart contract deployed on Sepolia "[0x6f250a12f9a2d6f72b6e8ef5b93484da04cdb69e](https://mumbai.polygonscan.com/address/0x6f250a12f9a2d6f72b6e8ef5b93484da04cdb69e)". The method will encode the current UNIX timestamp as the payload to be passed and stored in the destination chain contract. The data can be read by calling the `retrieve` function on the destination chain contract by querying the depositor address derived from the private key.
1313

1414
This is an example script that demonstrates the functionality of the Sygma SDK and the wider Sygma ecosystem of relayers and bridge and handler contracts. The complete example can be found in this [repo](
1515
https://github.com/sygmaprotocol/sygma-sdk/tree/main/examples/evm-to-evm-generic-mesage-passing).
@@ -79,7 +79,7 @@ cd examples/evm-to-evm-generic-mesage-passing
7979
yarn run transfer
8080
```
8181

82-
The example will use `ethers` in conjunction with the sygma-sdk to call a function on a smart contract on Goerli by calling the `Deposit` method on Sepolia and passing the details of the function to be called.
82+
The example will use `ethers` in conjunction with the sygma-sdk to call a function on a smart contract on Mumbai by calling the `Deposit` method on Sepolia and passing the details of the function to be called.
8383

8484
Replace the placeholder values in the `.env` file with your own Ethereum wallet private key and provider URL.
8585

Diff for: docs/02-sygma-sdk/03-Quick-Start/07-Examples/05-NodeJS-Token-Transfer-Example.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ draft: true
88
---
99

1010
:::info
11-
In the following example, we will setup and demonstrate a cross-chain ERC-20 token transfer between the same address from Goerli to Sepolia. This will be shown through the command line in a backend Node.js environment using the Sygma SDK.
11+
In the following example, we will setup and demonstrate a cross-chain ERC-20 token transfer between the same address from Mumbai to Sepolia. This will be shown through the command line in a backend Node.js environment using the Sygma SDK.
1212
:::
1313

1414
#### Prerequisites
1515

1616
- Install [Node.js](https://nodejs.org/en/about)(version 16 or above) for the backend JavaScript runtime environment.
17-
- Obtain an API key for the Ethereum `Goerli` testnet. An `API_KEY` will be required to initialize the `JsonRpcProvider` object with which blockchain interactions run through. You can sign up to obtain one for free with either [Infura](https://app.infura.io/) or [Alchemy](https://dashboard.alchemy.com/).
17+
- Obtain an API key for the Ethereum `Mumbai` testnet. An `API_KEY` will be required to initialize the `JsonRpcProvider` object with which blockchain interactions run through. You can sign up to obtain one for free with either [Infura](https://app.infura.io/) or [Alchemy](https://dashboard.alchemy.com/).
1818
- [MetaMask](https://metamask.io/) should be installed, and an account **used only for development purposes** should be created. [Export the `private key` from MetaMask](https://support.metamask.io/hc/en-us/articles/360015289632-How-to-export-an-account-s-private-key).
19-
- Obtain some `ERC20LRTest` tokens from the [Sygma faucet](https://faucet-ui-stage.buildwithsygma.com/). You will also need [Goerli ETH](https://goerlifaucet.com/) for gas.
19+
- Obtain some `ERC20LRTest` tokens from the [Sygma faucet](https://faucet-ui-stage.buildwithsygma.com/). You will also need [MATIC](https://maticfaucet.com/) for gas.
2020

2121
:::info
2222
The following example is written in `TypeScript`. You can use `CommonJS` with our SDK if you prefer to use standard `Node.js` for the script.
@@ -83,7 +83,7 @@ PROVIDER_API_KEY=your_provider_api_key_here
8383
PRIVATE_KEY=your_private_key_here
8484
```
8585

86-
Copy and paste (in quotations) the `Goerli` API key obtained from Infura or Alchemy, as well as the exported private key from MetaMask.
86+
Copy and paste (in quotations) the `Matic` API key obtained from Infura or Alchemy, as well as the exported private key from MetaMask.
8787

8888
:::danger
8989
Remember that your private key should **never** be exposed. Hence, **DO NOT** commit the `.env` file to any repository and add it to your `.gitignore` file. Exposing the private key could result in complete loss of your funds. **_For this example, please only paste in the exported private keys of a wallet that is designated for testing/development purposes_**.
@@ -113,7 +113,7 @@ if (!providerApiKey || !privateKey) {
113113

114114
#### Set up testnets and token symbol variables
115115

116-
Next, we setup some variables used for the rest of the script, including the two Ethereum testnets this example will conduct the token transfer on (`Goerli` and `Sepolia`) and the symbol of the test token (`ERC20LRTest`) we will be using. Paste in the following snippet into the same `transfer.ts` file:
116+
Next, we setup some variables used for the rest of the script, including the two Ethereum testnets this example will conduct the token transfer on (`Matic` and `Sepolia`) and the symbol of the test token (`ERC20LRTest`) we will be using. Paste in the following snippet into the same `transfer.ts` file:
117117

118118
```ts
119119
// transfer.ts
@@ -124,7 +124,7 @@ const RESOURCE_ID =
124124

125125
#### Create `assetTransfer` object
126126

127-
Now, we create a function that will return an `assetTransfer` object. This is the object that we are going to use to make the transfer between `Goerli` and `Sepolia`. Paste in the following snippet into the same `transfer.ts` file:
127+
Now, we create a function that will return an `assetTransfer` object. This is the object that we are going to use to make the transfer between `Matic` and `Sepolia`. Paste in the following snippet into the same `transfer.ts` file:
128128

129129
```ts
130130
// transfer.ts
@@ -218,7 +218,7 @@ Run this example in the command line with:
218218
npx ts-node ./src/index.ts
219219
```
220220

221-
If done correctly, the console log should return a `Transfer complete` message along with a transaction hash. The `Deposit` event for the `ERC20LRTest` token should appear shortly on `Goerli`, and the transferred tokens should appear shortly in the same address on `Sepolia`!
221+
If done correctly, the console log should return a `Transfer complete` message along with a transaction hash. The `Deposit` event for the `ERC20LRTest` token should appear shortly on `Matic`, and the transferred tokens should appear shortly in the same address on `Sepolia`!
222222

223223
Congratulations on successfully performing a cross-chain token transfer using the Sygma SDK!
224224

Diff for: docs/06-environments/02-devnet/01-obtain-devnet-tokens.md

-22
This file was deleted.

Diff for: docs/06-environments/02-devnet/02-adding-tokens-to-metamask.md

-17
This file was deleted.

Diff for: docs/06-environments/02-devnet/_category_.json

-7
This file was deleted.

0 commit comments

Comments
 (0)