GOSH Ethereum L2
Introduction
Endpoint for use with Ever-SDK
To explore the GOSH blockchain, you can use the GOSH explorer
First you need to get the address of user's profile.
The contract Profile is deployed for each user when registering with GOSH.
To get its address, you need to call the method getProfileAddr
of the VersionController contract
Transfer tokens
from GOSH to GOSH
Before transferring to another TIP-3 wallet, you need to check whether the recipient's TIP-3 wallet is already deployed.
To do this, you need to call the method getWalletAddress
in the RootTokenContract, the recipient's public key is specified.
If the recipient's TIP-3 wallet is not deployed, you need to call the method transferToRecipient
in the TIP-3 wallet contract "TONTokenWallet" (from which the transfer will be made).
Example
As a result, an empty TIP-3 wallet will be deployed to the recipient.
Warning
It is important to wait until the contract status changes to "Active".
Then, for transfer the TIP-3 tokens to the user, you need to call the method transfer
in the TONTokenWallet contract.
Example
from Ethereum to GOSH
For transfer tokens to GOSH, you need to call the method:
- for
ETH
:deposit
- for
ERC20
tokens:depositERC20
in the ELOCK contract.
Then it is necessary to calculate the address of the user's TIP-3 wallet in GOSH and wait the transfer of tokens to the received TIP3 user wallet in GOSH.
from GOSH to Ethereum
To transfer tokens to Ethereum, you will need to call method:
- for
ETH
:burnTokens
-
for
ERC20
tokens:withdrawERC20
(then to call
getERC20Approvement
to determine the commission that needs to be attached to the withdrawal function call)
in the user contract TONTokenWallet
Then wait for the receipt of tokens to the recipient's Ethereum wallet.
Getting the user's TIP-3 wallet address:
using by user name
Knowing the address of the user's contract Profile you call the method getAccess
in it.
As a result, you get a list of all the user's public keys with their numbers.
Important
It is necessary to take the zeroth pubkey from the list
Then, using the received user's public key, it will be possible to determine the address of the user's TIP-3 wallet
using the user's public key
To do this, in the RootTokenContract calling method getWalletAddress
Getting a list of incoming messages of the contract
Info
Using pagination in the SDK
Get info about TIP-3 wallet details
To get information about the TIP-3 wallet you will need to call the getDetails
method in the contract TONTokenWallet
Get TIP-3 root list
To get a list of ERC20 token addresses that are supported in GOSH Ethereum L2, you need to call the getTokenRoots
method in the ELOCK contract.
For every ERC20 token in the given list, execute the following get-methods:
name
symbol
decimals
After that, you need to call the method getRootAddr
in the Checker contract with the received data