Interface defining the frictionless conversion and atomic swapping of any FrictionlessFundDepositToken currency pair on the Frictionless protocol. The FX rates are set from the live spot & forward FX partners on the protocol.
Functions
setFXDeskFeeAddr
Sets the address of the FXDesk fee recipient Only Owner (PROTOCOL_ADMIN) can call this function
Parameters
Name
Type
Description
setSwapFees
Set the swap fees for the swaps of a token pair. The fees can be any combination of zero (0%) or upto 10000 bps (100%) on any directional transfer. Fees can only be set by the Owner (PROTOCOL_ADMIN).
Parameters
Name
Type
Description
setTokenFee
Set the fee associated with the swap of a Token and manages the mapping of the key to this set of Fees. Can only be set by the Owner (PROTOCOL_ADMIN).
Parameters
Name
Type
Description
swapTokens
Swaps tokens between addresses at a specified exchange rate Only PROTOCOL_TREASURY can call this function
Parameters
Name
Type
Description
fxDeskFeeAddr
Retrieves the address of the FXDesk fee recipient
Returns
Name
Type
Description
treasuryManager
Retrieves the Frictionless Treasury Manager contract
Returns
Name
Type
Description
permissionManager
Retrieves the Frictionless Permissions Manager contract
Returns
Name
Type
Description
getSwapFeesInfo
get the tokenFeeInfo set for the fees associated per token in an exchange.
Parameters
Name
Type
Description
Returns
Name
Type
Description
getSwapFeeKeys
Generates keys based on the packed encoding of the addresses of sets of tokens using the keccak256 hashing function. Used to store tokenFees in mappings.
Parameters
Name
Type
Description
Returns
Name
Type
Description
getTokenFeeKey
Generates a key based on the packed encoding of the addresses of both tokens using the keccak256 hashing function. Used to store tokenFees in mappings.
Parameters
Name
Type
Description
Returns
Name
Type
Description
getSellingTokensAmount
Calculates the amount of selling tokens based on the buying amount and exchange rate
Parameters
Name
Type
Description
Returns
Name
Type
Description
Events
FrictionlessFXTokensSwapped
Event emitted upon successful token swaps
Errors
FrictionlessFXSwapInvalidTokenAddresses
error thrown during setSwapFees if token adresses are invalid (zero addresses, equals addresses and etc.).
FrictionlessFXSwapInvalidFeeRecipientAddr
error thrown during setSwapFees, setTokenFee and swapTokens if the fxDeskFeeRecipient doesn't equal to the stored fxDeskFeeAddr
FrictionlessFXSwapNotEnoughPermissions
error thrown during swapTokens if the msg.sender is not a PROTOCOL_TREASURY.
Structs
FrictionlessTokenFXFeeInfo
Structure representing token fee information including the token address and fee information
address
The address where the bought tokens will be sent
buyingTokensAmount_
uint256
The amount of tokens being bought
buyingTokenExchangeRate_
uint256
The exchange rate of the token being bought to the token being sold
newFXDeskFeeAddr_
address
The new address of the FXDesk fee recipient
token0FeeInfo_
FrictionlessTokenFXFeeInfo
The fees associated with the token0 (first token) in the token pair during the swap.
token1FeeInfo_
FrictionlessTokenFXFeeInfo
The fees associated with the token1 (second token) in the token pair during the swap. throws FrictionlessFXSwapInvalidTokenAddresses if the token addresses are invalid. throws FrictionlessFXSwapInvalidFeeRecipientAddr if the feeRecipientAddr doesn't equal to the fxDeskFeeAddr. throws AbstractFeeModuleInvalidFeeRecipient if the feeRecipientAddr is a zero address throws AbstractFeeModuleInvalidFee if the feeInBps is not in the valid range (ZERO_FEES_IN_BPS to MAX_FEES_IN_BPS) emits FrictionlessFeeSet upon completion of the setting of the fee info for the token in either set of fees
tokenFeeKey_
bytes32
The key, generated by the function getTokenFeeKey, which is used to map a specific swap polarity for tokens.
tokenFeeInfo_
FrictionlessTokenFXFeeInfo
The fees associated with the swap of token, used in the calculation and disbursement of fees during swap of a token pair. throws FrictionlessFXSwapInvalidTokenAddresses if the token addresses are invalid. throws FrictionlessFXSwapInvalidFeeRecipientAddr if the feeRecipientAddr doesn't equal to the fxDeskFeeAddr. throws AbstractFeeModuleInvalidFeeRecipient if the feeRecipientAddr is a zero address throws AbstractFeeModuleInvalidFee if the feeInBps is not in the valid range (ZERO_FEES_IN_BPS to MAX_FEES_IN_BPS) emits FrictionlessTokenFeeSet upon completion of the setting of the fee info for the token
sellingTokenAddr_
address
The address of the token to be sold
buyingTokenAddr_
address
The address of the token to be bought
tokenSender_
address
The address of the sender initiating the swap
<none>
address
The address of the FXDesk fee recipient
<none>
IFrictionlessTreasuryManager
The address of the Frictionless Treasury Manager contract
<none>
IFrictionlessPermissionsManager
The address of the Frictionless Permissions Manager contract
token0_
address
the address of the first token in an exchange
token1_
address
the address of the second token in an exchange
<none>
FeeInfo
FeeInfo set for the fees associated per token in an exchange.
<none>
FeeInfo
token0_
address
the address of the token 0 in a transfer fee calculation
token1_
address
the address of the token 1 in a transfer fee calculation
<none>
bytes32
keys based on the packed encoding of the addresses of sets of tokens using the keccak256 hashing function.
<none>
bytes32
token0_
address
the address of the token 0 in a transfer fee calculation
token1_
address
the address of the token 1 in a transfer fee calculation
<none>
bytes32
generates a key based on the packed encoding of the addresses of both tokens using the keccak256 hashing function.
buyingTokensAmount_
uint256
The amount of tokens being bought
buyingTokenExchangeRate_
uint256
The exchange rate of the token being bought to the token being sold
<none>
uint256
The amount of selling tokens
tokenRecipient_
function setFXDeskFeeAddr(address newFXDeskFeeAddr_) external;
function setSwapFees(
FrictionlessTokenFXFeeInfo calldata token0FeeInfo_,
FrictionlessTokenFXFeeInfo calldata token1FeeInfo_
) external;
function setTokenFee(bytes32 tokenFeeKey_, FrictionlessTokenFXFeeInfo calldata tokenFeeInfo_) external;