Overview of EVM to Everscale Transfer Mechanics
Locking or Burning Target Tokens Based on Their Type:
To initiate a transfer on the EVM network, deposit the desired amount of the target token into the
MultiVault
contract on the EVM network. Please note that if the token is an Alien token (e.g., DAI, USDT, WBTC, etc.), the token owner must approve theMultiVault
contract before making the deposit. For detailed instructions, refer to the guide on Approving Alien Tokens.Once the deposit is complete, the
MultiVault
contract will handle the burning or locking of the token based on its type. Native tokens will be burned while Alien tokens will be locked.
Emitting Events:
- During this process, two events will be emitted, the
Deposit
event and either theAlienTransfer
orNativeTransfer
event, depending on the token type.
Transactions and logs examples can be found below:
Details
- Deposit Event Example Transaction
- Deposit Event Example Log
- AlienTransfer Event Example Transaction
- AlienTransfer Event Example Log
- NativeTransfer Event Example Transaction
- NativeTransfer Event Example Log
- During this process, two events will be emitted, the
Deploying and Confirming the Event Contract:
After the events are emitted by the
MultiVault
contract, it is necessary to deploy an event contract on the Everscale network.Relayers will then vote on the event contract to confirm the deposit on the EVM network, it will take
blocksToConfirm
blocks for relayers to confirm the event contract.Methods for deploying the Event contract:
3.1 Paying Everscale Operations Gas Fees with EVM Gas Tokens:
- If Everscale operations gas fees are paid with EVM gas tokens, the user must attach enough gas tokens to the transaction. The Credit Modules will deploy the event contract on Everscale. Afterward, tokens will be automatically minted or released on Everscale. To perform this operation, besides attaching sufficient EVM gas tokens to the transaction, the expected_evers parameter must be set to a certain amount.
3.2 Paying Everscale Operations Gas Fees with EVER:
- If Everscale operations gas fees are paid with EVER, the user can proceed without attaching enough EVM gas tokens and set expected_evers to zero. At this point, the user needs to manually deploy the event contract by calling the
deployEvent
function on theEthereumEverscaleEventConfiguration
contract. This will deploy an Event contract, and after exceeding the quorum of confirm votes by relayers, the token will be released if it's a Native token and minted if it's an Alien token.
At this point the tokens must be deposited to the recipient EVER Wallet.
TIP
blocksToConfirm
value can be fetched from the relevant event config contract
Step-by-Step Guide: EVM to Everscale Transfer
Alien & Native Token Transfer
- Alien
- Native
- If the the target token was an Alien or a Native token we must use the
deposit
function onMultiVault
contract, but if the token was an Alien token, we must approveMultiVault
for the desired token amount before depositing the tokens.
Once approved, the deposit function can be called.
Notice that if the token was a Native token the approval is not needed.
Function
function deposit(depositParams memory d) external payable override;
Details
Parameters
struct DepositParams {
IEverscale.EverscaleAddress recipient;
address token;
uint amount;
uint expected_Evers;
bytes payload;
}
Param | Description |
---|---|
recipient | Everscale address of recipient |
token | Target token |
amount | Amount of the target token |
expected_Evers | See expected_Evers |
payload | Operational payload, see payloads |
Example Transaction
- Now it's time to deploy the event contract which can be accomplished in two ways:
- 2.1: See Overview of Everscale to EVM transfer mechanics: 3.1..
- 2.2: Deploy the event contract manually by calling the
deployEvent
function on theEthereumEverscaleEventConfiguration
contract:
Function
function deployEvent(IEthereumEverscaleEvent.EthereumEverscaleEventVoteData eventVoteData) external override;
Details
Parameters
struct EthereumEverscaleEventVoteData {
uint eventTransaction;
uint32 eventIndex;
TvmCell eventData;
uint32 eventBlockNumber;
uint eventBlock;
}
The previous deposit functions emit AlienTransfer
or NativeTransfer
events. The following parameters can be fetched and prepared from the emitted event data and its root transaction. see Deploy Events.
Param | Description |
---|---|
eventTransaction | EventTransaction Hash |
eventIndex | EventIndex |
eventData | EventData |
eventBlockNumber | EventBlockNumber |
eventBlock | EventBlock Hash |
Instructions on how to get these values can be found in deploy Events
Example Transactions
EVM Gas Token Transfer
- If the target token was the EVM network gas token, we must use the
depositByNativeToken
function on theMultiVault
contract and attach the desired amount of the gas token equal to the amount value parameter of the function call to the transaction:
NOTE : In the
MultiVault
contract the EVM gas token will be converted to its wrapped version and become an ERC20 token, then the rest of the operation will be resumed.
Function
function depositByNativeToken(DepositNativeTokenParams memory d) external payable override;
Details
Parameters
struct DepositNativeTokenParams {
IEverscale.EverscaleAddress recipient;
uint amount;
uint expected_Evers;
bytes payload;
}
Param | Description |
---|---|
recipient | Everscale address of recipient |
amount | Amount of the EVM gas token |
expected_Evers | See expected_Evers |
payload | Operational payload, see payloads |
Example Transactions
WARNING
Next step is only necessary if Everscale operations fees are paid with EVER
- Now it's time to deploy the event contract which can be accomplished in two ways:
2.1: See Overview of Everscale to EVM transfer mechanics: 3.1.
2.2: Deploy the event contract manually by calling the
deployEvent
function on theEthereumEverscaleEventConfiguration
contract:
Function
function deployEvent(IEthereumEverscaleEvent.EthereumEverscaleEventVoteData eventVoteData) external override;
Details
Parameters
- 2.2.1
struct EthereumEverscaleEventVoteData {
uint eventTransaction;
uint32 eventIndex;
TvmCell eventData;
uint32 eventBlockNumber;
uint eventBlock;
}
The previous deposit functions emit AlienTransfer
or NativeTransfer
events. The following parameters can be fetched and prepared from the emitted event data and its root transaction. see Deploy Events.
Param | Description |
---|---|
eventTransaction | EventTransaction Hash |
eventIndex | EventIndex |
eventData | EventData |
eventBlockNumber | EventBlockNumber |
eventBlock | EventBlock Hash |
Instructions on how to get these values can be found in deploy Events
Example Transactions
Interactive code samples related to examples above can be found here
The addresses of all the referenced contracts and tokens can be found at Links.