Swap
SwapCraft Function
Taya is an automated market maker (AMM), a decentralized exchange (DEX) that allows users to trade assets directly without the need for a traditional order book to match buyers and sellers.
SwapCraft Function
At the heart of SwapCraft lies the "swapTokens" function, a powerful mechanism that facilitates token exchanges with ease. Let's delve into its core components:
poolIdentifier
: Identifies the pool designated for the swap.tradeType
: Precisely defines the type of trade, allowing for either "Out Given Exact In" or "In Given Exact Out" swaps.inputAsset
: Refers to the asset intended to be swapped into the pool.outputAsset
: Signals the asset to be acquired in exchange.tradeAmount
: Its meaning seamlessly adjusts according to the selected "tradeType":GIVEN_IN
: Signifies the amount of assets being dispatched.GIVEN_OUT
: Designates the target amount of assets to be received.
userSpecificData
: This field serves as a conduit for any supplementary information necessary for the pool to execute the swap, thus facilitating future enhancements in the swapping protocol.
TokenSwap Structure
A vital cog in the SwapCraft machinery is the "TokenSwap" structure, meticulously outlined as follows:
AssetManagement Structure
The "AssetManagement" structure plays a pivotal role in determining the flow of input and output assets. It takes the following form:
senderAddress
: Specifies the address from which assets will be sourced for the swap.sourceFromInternalStorage
: Dictates whether the assets should be drawn from the sender's pre-existing holdings within the Vault.Taya's bespoke swap function tailored to our unique pool types, fortified with the robust technology inherited from the Balancer swap module.
Tayaswap's bespoke swap function tailored to our unique pool types, fortified with the robust technology inherited from the Balancer swap module.
Last updated