Trade

TradeModule.sol

Module that enables SetTokens to perform atomic trades using uniswap-like (e.g. Uniswap, Sushiswap, Pancakeswap, ...etc) Decentralized Exchanges. Integrations mappings are stored on the IntegrationRegistry contract.

initialize

Initializes this module to the SetToken. Only callable by the SetToken's manager.

function initialize(ISetToken _setToken) external
  • _setToken Instance of the SetToken to initialize

trade

Executes a trade on a supported DEX. Only callable by the SetToken's manager. Note that 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.

function trade(ISetToken _setToken, string memory _exchangeName, address _sendToken, uint256 _sendQuantity, address _receiveToken, uint256 _minReceiveQuantity, bytes memory _data ) external
  • _setToken Instance of the SetToken to trade

  • _exchangeName Human readable name of the exchange that has been registered the registry

  • _sendToken Address of the token to be sent to the exchange

  • _sendQuantity Units of token in SetToken sent to the exchange

  • _receiveToken Address of the token that will be received from the exchange

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

  • _data Arbitrary bytes to be used to construct trade call data

Last updated