Skip to content

INestorFXSwap

Git Source

Inherits: IAbstractFeeModule

Author: Originally developed by DEFYCA Labs S.a.r.l., maintained by Nestor Exchange OÜ

MIT Licence. Originally Copyright © 2023 DEFYCA Labs S.a.r.l.

Interface defining the conversion and atomic swapping of any NestorFundDepositToken currency pair on the Nestor Protocol. The FX rates are set from the live spot & forward FX partners on the protocol.

Functions

setFXDeskFeeAddr

function setFXDeskFeeAddr(address newFXDeskFeeAddr_) external;

setSwapFees

function setSwapFees(NestorTokenFXFeeInfo calldata token0FeeInfo_, NestorTokenFXFeeInfo calldata token1FeeInfo_) external;

setTokenFee

function setTokenFee(bytes32 tokenFeeKey_, NestorTokenFXFeeInfo calldata tokenFeeInfo_) external;

swapTokens

Swaps tokens between addresses at a specified exchange rate. Only PROTOCOL_TREASURY can call this function.

function swapTokens(
    address sellingTokenAddr_, address buyingTokenAddr_,
    address tokenSender_, address tokenRecipient_,
    uint256 buyingTokensAmount_, uint256 buyingTokenExchangeRate_
) external;

fxDeskFeeAddr

function fxDeskFeeAddr() external view returns (address);

treasuryManager

function treasuryManager() external view returns (INestorTreasuryManager);

permissionManager

function permissionManager() external view returns (INestorPermissionsManager);

getSwapFeesInfo

function getSwapFeesInfo(address token0_, address token1_) external view returns (FeeInfo memory, FeeInfo memory);

getSwapFeeKeys

function getSwapFeeKeys(address token0_, address token1_) external view returns (bytes32, bytes32);

getTokenFeeKey

function getTokenFeeKey(address token0_, address token1_) external view returns (bytes32);

getSellingTokensAmount

function getSellingTokensAmount(uint256 buyingTokensAmount_, uint256 buyingTokenExchangeRate_) external view returns (uint256);

Events

NestorFXTokensSwapped

event NestorFXTokensSwapped(
    address sellingTokenAddr, address buyingTokenAddr,
    address tokenSender, address tokenRecipient,
    uint256 sellingTokensAmount, uint256 buyingTokensAmount,
    uint256 buyingTokenExchangeRate
);

Errors

NestorFXSwapInvalidTokenAddresses

error NestorFXSwapInvalidTokenAddresses(address token0, address token1);

NestorFXSwapInvalidFeeRecipientAddr

error NestorFXSwapInvalidFeeRecipientAddr(address newFeeRecipient);

NestorFXSwapNotEnoughPermissions

error NestorFXSwapNotEnoughPermissions();

Structs

NestorTokenFXFeeInfo

struct NestorTokenFXFeeInfo {
    address tokenAddr;
    uint256 feeAbsoluteLimit;
    FeeInfo feeInfo;
}