Skip to main content

FT Token

Overview

The FT token is Flying Tulip's native cross-chain token built on LayerZero's OFT standard, enabling seamless transfers between supported blockchains while incorporating pause functionality and role-based access control.

Technical Implementation

The FT token contract:

  • Is initially deployed with 10 billion tokens minted on Sonic chain (ID 146)
  • Implements ERC20Permit for gasless approval transactions
  • Features a pausing mechanism that can be controlled by owner or configurator
  • Supports burning functionality for token redemption mechanisms
  • Uses LayerZero's OFT standard for cross-chain transfers

Access Control

The contract has two privileged roles:

  • Owner: Can change token name/symbol and toggle pause state
  • Configurator: Can toggle pause state and transfer configurator role

When paused, transfers are restricted except for:

  • The configurator address
  • The LayerZero endpoint
  • Messages initiated by the configurator

Contract Inheritance

The contract inherits all standard ERC20 functions (balanceOf, totalSupply, allowance, etc.) and ERC20Permit functions (permit, nonces, DOMAIN_SEPARATOR).

Write Functions

transfer

Transfers tokens from caller to recipient

function transfer(address to, uint256 amount) external returns (bool)	

Parameters

to: Recipient address

amount: Amount to transfer

Returns

bool: Success boolean

transferFrom

Transfers tokens using allowance mechanism

function transferFrom(address from, address to, uint256 amount) external returns (bool)	

Parameters

from: Source address

to: Destination address

amount: Amount to transfer

Returns

bool: Success boolean

approve

Sets spender's allowance over caller's tokens

function approve(address spender, uint256 amount) external returns (bool)	

Parameters

spender: Address to authorize

amount: Allowance amount

Returns

bool: Success boolean

increaseAllowance

Increases spender's allowance

function increaseAllowance(address spender, uint256 addedValue) external returns (bool)

Parameters

spender: Address to authorize

addedValue: Amount to add to allowance

Returns

bool: Success boolean

decreaseAllowance

Decreases spender's allowance

function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool)	

Parameters

spender: Address to authorize

subtractedValue: Amount to subtract from allowance

Returns

bool: Success boolean

permit

Approves spender to spend owner's tokens via signed authorization

function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external	

Parameters

owner: Token owner

spender: Authorized spender

value: Amount to approve

deadline: Permit expiration timestamp

v, r, s: Signature components

burn

Burns tokens from caller's balance

function burn(uint256 amount) external

Parameters

amount: Number of tokens to burn

burnFrom

Burns tokens from another account (requires approval)

function burnFrom(address account, uint256 amount) external

Parameters

account: Address to burn from

amount: Number of tokens to burn

setPaused

Pauses or unpauses token transfers

function setPaused(bool isPaused) external

Parameters

isPaused: True to pause, false to unpause

transferConfigurator

Transfers configurator role to new address

function transferConfigurator(address newConfigurator) external

Parameters

newConfigurator: New configurator address

setName

Changes token name

function setName(string memory newName) external

Parameters

newName: New token name

setSymbol

Changes token symbol

function setSymbol(string memory newSymbol) external	

Parameters

newSymbol: New token symbol

send

Sends tokens to another chain

function send(uint16 dstChainId, bytes calldata to, uint256 amount, address zroPaymentAddress, bytes calldata adapterParams) external payable	

Parameters

dstChainId: Destination chain ID

to: Recipient address bytes

amount: Amount to send

zroPaymentAddress: ZRO payment address

adapterParams: Parameters for the adapter

View Functions

name

Gets token name

function name() public view returns (string memory)	

Returns

string: Current token name

symbol

Gets token symbol

function symbol() public view returns (string memory)

Returns

string: Current token symbol

totalSupply

Returns the total token supply

function totalSupply() external view returns (uint256)	

Returns

uint256: Total token supply

balanceOf

Returns the token balance of an account

function balanceOf(address account) external view returns (uint256)	

Parameters

account: Address to query

Returns

uint256: Token balance

allowance

Returns amount spender is allowed to use on behalf of owner

function allowance(address owner, address spender) external view returns (uint256)	

Parameters

owner: Token owner

spender: Authorized spender

Returns

uint256: Allowance amount

nonces

Returns the current nonce for owner (used in permit)

function nonces(address owner) external view returns (uint256)	

Parameters

owner: Address to query

Returns

uint256: Current nonce

configurator

Gets configurator address

function configurator() external view returns (address)	

Returns

address: Current configurator address

estimteSendFee

Estimates fee for sending tokens to another chain

function estimateSendFee(uint16 dstChainId, bytes calldata to, uint256 amount, bool useZro, bytes calldata adapterParams) external view returns (uint256 nativeFee, uint256 zroFee)	

Parameters

dstChainId: Destination chain ID

to: Recipient address bytes

amount: Amount to send

useZro: Whether to use ZRO token for fees

adapterParams: Parameters for the adapter

Returns

nativeFee: Fee in native currency

zroFee: Fee in ZRO tokens

circulatingSupply

Returns the circulating supply of tokens on the current chain

function circulatingSupply() external view returns (uint256)	

Returns

uint256: Circulating supply

owner

Returns the address of the current owner

function owner() public view returns (address)	

Returns

address: Owner address

SONIC_CHAIN_ID

Gets the Sonic chain ID

function SONIC_CHAIN_ID() public view returns (uint16)	

Returns

uin16: Sonic chain ID (146)

DOMAIN_SEPARATOR

Returns the domain separator used in the encoding of the signature for permit

function DOMAIN_SEPARATOR() external view returns (bytes32)	

Returns

bytes32: Domain separator hash

eip712Domain

Returns the EIP712 domain values used for permit signatures

function eip712Domain() external view returns (bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions)	

Returns

fields: Bit field indicating which parameters are present

name: Name of the signing domain (token name)

version: Version of the signing domain (typically "1")

chainId: Chain ID where contract is deployed

verifyingContract: Address of the token contract

salt: Domain disambiguator (typically unused)

extensions: Array for future extensions (typically empty)

Mainnet Deployments

Ethereum: 1

ContractAddress
Flying Tulip0x0

Binance Smart Chain: 56

ContractAddress
Flying Tulip0x0

Sonic: 146

ContractAddress
Flying Tulip0x0

Avalanche: 43114

ContractAddress
Flying Tulip0x0