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
{{ message }}
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: 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 number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ draft: false
9
9
10
10
### EVM-to-EVM token transfer example
11
11
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.
13
13
14
14
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](
@@ -21,7 +21,7 @@ Before running the script, ensure that you have the following:
21
21
- Node.js v18
22
22
- Yarn (version 3.4.1 or higher)
23
23
- 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
25
25
- An Ethereum [provider](https://www.infura.io/) (in case the hardcoded RPC within the script does not work)
26
26
- 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)
27
27
@@ -87,7 +87,7 @@ cd examples/evm-to-evm-fungible-transfer
87
87
yarn run transfer
88
88
```
89
89
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.
91
91
92
92
### Script functionality
93
93
@@ -127,7 +127,7 @@ export async function erc20Transfer(): Promise<void> {
127
127
128
128
```ts
129
129
const provider =newproviders.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
Copy file name to clipboardExpand all lines: 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 number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ draft: false
9
9
10
10
### EVM-to-Substrate token transfer example
11
11
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.
13
13
14
14
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](
@@ -22,9 +22,9 @@ Before running the script, ensure that you have the following:
22
22
- Yarn (version 3.4.1 or higher)
23
23
- 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
24
- 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
26
26
- 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/)
28
28
29
29
<divstyle={{textAlign:'center'}}>
30
30
<iframe
@@ -90,7 +90,7 @@ cd examples/evm-to-substrate-fungible-transfer
90
90
yarn run transfer
91
91
```
92
92
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.
const DESTINATION_ADDRESS ="5CDQJk6kxvBcjauhrogUc9B8vhbdXhRscp1tGEUmniryF1Vt"; // replace this value for your preferred Substrate address
107
107
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
109
109
```
110
110
111
111
- 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> {
131
131
132
132
```ts
133
133
const provider =newproviders.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
135
135
);
136
136
const wallet =newWallet(
137
137
privateKeyasstring,
@@ -149,7 +149,7 @@ export async function erc20Transfer(): Promise<void> {
149
149
ROCOCO_PHALA_CHAIN_ID,
150
150
DESTINATION_ADDRESS,
151
151
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
Copy file name to clipboardExpand all lines: 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 number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ draft: false
9
9
10
10
### EVM-to-Substrate token transfer example
11
11
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.
13
13
14
14
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).
15
15
@@ -22,7 +22,7 @@ Before running the script, ensure that you have the following:
22
22
- The 12-word mnemonic for your Substrate development wallet
23
23
- An Ethereum wallet to receive tokens into (the example presets an existing wallet address already)
24
24
- 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
26
26
27
27
:::danger
28
28
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
81
81
yarn run transfer
82
82
```
83
83
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.
85
85
86
86
### Script functionality
87
87
@@ -96,8 +96,8 @@ import { cryptoWaitReady } from "@polkadot/util-crypto";
const RESOURCE_ID ="0x0000000000000000000000000000000000000000000000000000000000001000"; // This is the resource ID for the gPHA token according to Sygma's testnet environment
99
+
constSEPOLIA_CHAIN_ID=11155111;
100
+
const RESOURCE_ID ="0x0000000000000000000000000000000000000000000000000000000000001100"; // This is the resource ID for the sygUSD token according to Sygma's testnet environment
101
101
const recipient ="0xD31E89feccCf6f2DE10EaC92ADffF48D802b695C"; // replace this value for your preferred EVM address
102
102
```
103
103
@@ -174,10 +174,10 @@ const getStatus = async (
174
174
```ts
175
175
const transfer =assetTransfer.createFungibleTransfer(
176
176
account.address,
177
-
GOERLI_CHAIN_ID,
177
+
SEPOLIA_CHAIN_ID,
178
178
recipient,
179
179
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
Copy file name to clipboardExpand all lines: 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 number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ draft: false
9
9
10
10
### GMP Example With A Simple Storage Contract
11
11
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.
13
13
14
14
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](
@@ -79,7 +79,7 @@ cd examples/evm-to-evm-generic-mesage-passing
79
79
yarn run transfer
80
80
```
81
81
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.
83
83
84
84
Replace the placeholder values in the `.env` file with your own Ethereum wallet private key and provider URL.
Copy file name to clipboardExpand all lines: docs/02-sygma-sdk/03-Quick-Start/07-Examples/05-NodeJS-Token-Transfer-Example.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -8,15 +8,15 @@ draft: true
8
8
---
9
9
10
10
:::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.
12
12
:::
13
13
14
14
#### Prerequisites
15
15
16
16
- 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/).
18
18
-[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.
20
20
21
21
:::info
22
22
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.
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.
87
87
88
88
:::danger
89
89
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) {
113
113
114
114
#### Set up testnets and token symbol variables
115
115
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:
117
117
118
118
```ts
119
119
// transfer.ts
@@ -124,7 +124,7 @@ const RESOURCE_ID =
124
124
125
125
#### Create `assetTransfer` object
126
126
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:
128
128
129
129
```ts
130
130
// transfer.ts
@@ -218,7 +218,7 @@ Run this example in the command line with:
218
218
npx ts-node ./src/index.ts
219
219
```
220
220
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`!
222
222
223
223
Congratulations on successfully performing a cross-chain token transfer using the Sygma SDK!
0 commit comments