FlatQube
▶️ App🔩 Sources💬 Community🔒 Audit
  • Welcome to FlatQube
  • 👨‍💻Use
    • Getting started
      • How it works
      • Roles
      • How to connect a wallet
      • Glossary
      • Everscale
      • How to get EVER
    • Swap
      • Interface
        • Basic swap
      • How to
        • Make a basic swap
        • Use limit trading
        • Configure slippage tolerance
        • Use cross-exchange
      • Concepts
        • Limit orders
        • Slippage tolerance
        • Fees
        • Price impact
        • Cross-exchange
    • Tokens
      • Interface
        • All tokens
        • Token page
          • Price
          • TVL
          • Trading volume
          • Pairs
          • Transactions
          • Open in explorer
      • How to
        • Upgrade token(s)
        • Add custom token
      • Concepts
        • Tokens we use
        • EVER and wEVER
        • Token lists
    • Pools
      • Interface
        • All pools
        • Pool page
      • How to
        • Connect DEX account
        • Add liquidity (Get LP tokens) / Withdraw liquidity
        • Create a new pool
        • Calculate the amount of LP tokens
      • Pool economics
    • Farming
      • New farming
        • Interface
          • Farming pools
          • Farming page (user)
            • Farming performance and deposits
            • Statistics
            • Farming speed and vesting
            • Transactions
          • Farm page (administrator)
        • How to
          • Claim reward
          • Deposit/Withdraw farm tokens
          • Get a boost
          • Create and manage your farming pool
      • Old farming
        • Interface
          • Farming pools
          • Farm page (user)
            • Farming perfomance and balances
            • Statistics
            • Farming speed
            • Farm information
            • Transactions
          • Farm page (administrator)
        • How to
          • Claim reward
          • Deposit farm tokens
          • Withdraw farm tokens
          • See farming performance
          • Find my transactions
      • Concepts
        • Yield farming
        • Reward distribution
        • Vesting
        • Farming token
        • Boosted farming
        • Pool share
    • DAO
      • Interface
        • DAO page
        • DAO balance
        • Epoch
      • How to
        • Lock tokens
        • Vote in Epoch
        • Get a boost
        • Become a candidate
      • Concept
        • DAO
        • veQUBE
        • Epoch
        • Boosted farming
        • FAQ
    • Token builder
      • Interface
        • Explorer
        • Token page
      • How to
        • Create new token
        • Mint tokens
        • Burn tokens
        • Transfer ownership
  • ⚒️Integrate
    • Open API
      • FlatQube DEX Indexer
        • CMC API
        • Currencies API
        • Pairs API
        • Transactions API
      • FlatQube Farming Indexer
        • Farming pools API
        • Transactions API
        • Graphics API
    • Smart contracts
      • DexAccount
      • DexPair
      • DexPlatform
      • DexRoot
      • DexVault
      • DexVaultLpTokenPending
      • EverToTip3
      • EverWeverToTip3
      • Tip3ToEver
      • TokenFactory
  • ↗️See also
    • EVER Wallet
    • Octus Bridge
    • Platform products
    • Broxus Github
Powered by GitBook
On this page

Was this helpful?

Last updated 2 years ago

Was this helpful?

Smart contract responsible for swapping evers to Tip3 tokens.

Derives following classes and interfaces: IAcceptTokensMintCallback, IAcceptTokensTransferCallback, IAcceptTokensBurnCallback, IEverTip3SwapEvents.

constructor

Deploys wallet with EverToTip3 contract address.

buildExchangePayload

Creates payload constructor for swap between Ever and Tip-3 token - takes id, amount, pair address, expectedAmount, deployWalletValue from params and store those values to the TVMBuilder instance.

Parameters:

Name
Type
Description

Return Value:

Type
Description

Swap

swapEvers

Takes user address and payload as params if there are enough EVERs swap them with Tip-3 token, if not cancel.

Parameters:

Callbacks

onWeverWallet

Deploys Wever wallet for the contract using _weverWallet address from the function params.

Parameters:

onAcceptTokensMint

Checks if weverWallet is the message sender and message sender value is greater than 0, if value is ge then SWAP_EVER_TO_TIP_3_MIN_VALUE, if so emit SwapEverToTip3WeverMint event, create success, cancel and result payload, transfer the amount from the function params of tokens from EverToTip3 wallet to the pair’s address, else transfer to the weverVault address (burn Wevers).

Parameters:

onAcceptTokensTransfer

If operationStatus is cancel, burn WEVERs (transfer them to weverVault address), if it is SUCCESS call the callback function for swapping evers to tip 3 (onSwapEversToTip3Success), emit SwapEversToTip3SuccessTransfer event and send tip 3 tokens to the user using TokenWallet’s transfer function. If it’s not SUCCESS or CANCEL set needCancel var to true and transfer the amount back to the sender.

Parameters:

onAcceptTokensBurn

Callback function used when swap is canceled. Emit SwapEverToTip3CancelTransfer and call callback function onSwapEverToTip3CancelTransfer.

Parameters:

Key Events

SwapEverToTip3WeverMint

Emitted inside onAcceptTokensMint callback.

SwapEverToTip3SuccessTransfer

Emitted inside onAcceptTokensTransfer callback when EVERs are successfully swapped to Tip3 tokens.

SwapEverToTip3CancelTransfer

Emitted inside of the onAcceptTokensBurn when swap is canceled .

Name
Type
Description
Name
Type
Description
Name
Type
Description
Name
Type
Description
Name
Type
Description
constructor() public
function buildExchangePayload(uint64 id, uint128 amount, address pair, uint128 expectedAmount, uint128 deployWalletValue) external pure returns (TvmCell)

id

uint64

Payload Id

amount

uint128

Amount to exchange

pair

address

Exchange pair root address

expectedAmount

uint128

Expected amount after exchange

deployWalletValue

uint128

Value for deploying new wallet

TvmCell

Exchange payload in cell format

function swapEvers(address user, TvmCell payload) external

user

address

Address of the user initiating exchange

payload

TvmCell

Payload used for wrapping EVERs

function onWeverWallet(address _weverWallet) external

_weverWallet

address

Address used to initialize wever wallet

function onAcceptTokensMint(address /*tokenRoot*/, uint128 amount, address user, TvmCell payload) override external

token_root

address

Address of the token root

amount

uint128

Amount of tokens to transfer to user

user

address

Address of the user to transfer remaining gas

payload

TvmCell

Payload with exchange data (id, amount, pair, expectedAmount, deploy value…)

function onAcceptTokensTransfer(address /*tokenRoot*/, uint128 amount, address sender, address /*senderWallet*/, address user, TvmCell payload) override external

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 tip3 tokens

payload

TvmCell

Transfer payload data

function onAcceptTokensBurn(uint128 /*amount*/, address /*walletOwner*/, address /*wallet*/, address user, TvmCell payload) override external

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

SwapEverToTip3WeverMint(uint64 id, uint128 amount, address pair, uint128 expectedAmount, uint128 deployWalletValue);
SwapEverToTip3SuccessTransfer(address user, uint64 id);
SwapEverToTip3CancelTransfer(address user, uint64 id);
  1. ⚒️Integrate
  2. Smart contracts

EverToTip3

With this smart contract you can swap evers to Tip3 tokens.

PreviousDexVaultLpTokenPendingNextEverWeverToTip3
  • constructor
  • buildExchangePayload
  • Swap
  • swapEvers
  • Callbacks
  • onWeverWallet
  • onAcceptTokensMint
  • onAcceptTokensTransfer
  • onAcceptTokensBurn
  • Key Events
  • SwapEverToTip3WeverMint
  • SwapEverToTip3SuccessTransfer
  • SwapEverToTip3CancelTransfer