Trade Extension

Smart contract global extension which provides DelegatedManager privileged operator(s) the ability to trade on a DEX and the owner the ability to restrict operator(s) permissions with an asset whitelist.

This extension should all be added and initialized as part of the DelegatedManager factory deployment flow. See DelegatedManager extensions APIs at set.js for TS helpers to encode appropriate initializeModuleAndExtension or initializeExtension calls you will pass as arguments in the initializeBytecode parameter when executing DelegatedManagerFactory#initialize.

Select Functions

trade

function trade()
  onlyOperator(_setToken)
  onlyAllowedAsset(_setToken, _receiveToken)

ONLY OPERATOR: Executes a trade on a supported DEX. 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.

NOTE: The _receiveToken must be listed in the DelegatedManager's assetAllowlist or the Manager's useAssetAllowlist must be set to false (skipping allowlist enforcement) for trade to execute.

Name

Type

Description

_setToken

address

Instance of the SetToken to trade components of.

_exchangeName

string

Human readable name of the exchange in the integrations registry

_sendToken

address

Address of the component 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

Last updated