TradeModule

The Trade Module is a module that enables SetTokens to perform atomic trades using DEXs such as Uniswap, Sushiswap and 1inch. Integrations mappings are stored on the IntegrationRegistry contract.

Select Methods

trade()

function trade(ISetToken _setToken, string memory _exchangeName, address _sendToken, uint256 _sendQuantity, address _receiveToken, uint256 _minReceiveQuantity, bytes memory _data)

Manager only. Executes a trade on a supported DEX. Only callable by the SetToken's manager. Although the SetToken units are passed in for the send and receive quantities, the total quantity sent and received is the quantity of SetToken units multiplied by the SetToken totalSupply.

Parameter Name

Type

Description

_setToken

ISetToken

Instance of the SetToken

_exchangeName

string

Human readable name of the exchange in the integrations registry

_sendToken

address

Address of the token to be sent to the exchange

_sendQuantity

uint256

Units of token in SetToken sent to the exchange

_receiveToken

address

Address of the token that will be received from the exchange

_minReceiveQuantity

uint256

Min units of token in SetToken to be received from the exchange

_data

bytes

Arbitrary bytes to be used to construct trade call data

initialize()

function initialize(ISetToken _setToken)

Manager only. Initializes this module to the SetToken.

Parameter Name

Type

Description

_setToken

ISetToken

Address of the SetToken

Last updated