Tip3ToEver
The Tip3ToEver smart contract defines the logic for swapping Tip3 To Ever.
Smart contract responsible for swapping Tip3 token to Ever.
Derives following classes and interfaces: IAcceptTokensTransferCallback, IAcceptTokensBurnCallback, IEverTip3SwapEvents.
constructor
constructor
Deploy empty wallet.
buildExchangePayload
buildExchangePayload
Build payload constructor for exchanging TIP 3 to EVER, store values from function params to TVMBuilder
instance.
Parameters:
id
uint64
Id of the operation call
pair
address
Address of the exchange pair
expectedAmount
uint128
Expected amount of tokens after exchange
Callbacks
onWeverWallet
onWeverWallet
Callback deploy for weverWallet
.
Parameters:
_weverWallet
address
Address of the WEVER wallet
onAcceptTokensTransfer
onAcceptTokensTransfer
Callback for swap. If operationStatus is SWAP and value is greater than SWAP_TIP3_TO_EVER_MIN_VALUE
, build success, cancel and resultPayload
and transfer from Tip3ToEver
wallet to the pairโs wallet.
If operationStatus is CANCEL emit SwapTip3EverCancelTransfer
event and call OnSwapTip3ToEverCancel
callback and transfer the amount back to the user, if SUCCESS and msg sender is weverWallet
, transfer the amount to weverVault wallet.
Else if needCancel var is true transfer value back to the sender
Parameters:
tokenRoot
address
Address of token root
amount
uint128
Amount of tokens to transfer
sender
address
Address of tokens sender
senderWallet
address
Tokens senderโs wallet address
user
address
Userโs address for receiving EVER tokens
payload
TvmCell
Transfer payload data
onAcceptTokensBurn
onAcceptTokensBurn
Callback for burn if the swap succeeded, emits SwapTip3EverSuccessTransfer
event and call callback onSwapTip3ToEverSuccess
.
Parameters:
amount
uint128
Amount of tokens to burn (optional)
walletOwner
address
Address of wallet owner
wallet
address
Wallet address
user
address
Userโs address that canceled exchange
payload
TvmCell
Burn tokens payload data
Key Events
SwapTip3EverSuccessTransfer
SwapTip3EverSuccessTransfer
Emitted inside onAcceptTokensTransfer
callback when Tip3 tokens are successfully swapped to EVERs.
SwapTip3EverCancelTransfer
SwapTip3EverCancelTransfer
Emitted inside onAcceptTokensTransfer
callback when swap is canceled.
Last updated