Trading ABI and Documentation

ABI

https://github.com/wowswap-io/evm-sdk-public

Structs

ClosePositionRequest

📄 Configuration parameters for a closing position transaction

Developer should use pragma experimental ABIEncoderV2; to pack struct to calldata with struct

All positions tokens support EIP-2612 for disbursement via an offchain signature, not a approve of transaction

Fields:

short should be true if a short position is closed (false if a long position)

amountIn the number of position tokens to close (can pass type(uint256).max to close the all position)

amountOutMin minimum allowed number of tokens to be received lendable after closing (if the exchange returns less during the closing process - the transaction will be rejected)

lendable is an address of lendable token

proxy is an address of proxy token (should be address(0) if direct swap)

tradable is an address of tradable token if position is long, overwise is shortable

trader is an address of position holder

deadline deadline of permit on spending position tokens for Router instance

referrer is an address of position holder referrer (should be address(0) if no referrer)

permit is a structure of v , r , s with ERC-2612 permit

convertToNative should be true if lendable is wrapped native currency and expect unwrapping to native at the end of transaction

OpenPositionRequest

📄 Transaction configuration parameters for opening a long position

Developer should use pragma experimental ABIEncoderV2; to pack struct to calldata with struct Developer should call PriceSigner service to obtain guarded field data before call open position

amountIn the number of lendable tokens to open a position and to be used as collateral for the position

leverageFactor determines the leverage of the position (specified in decimals, i.e. x1 is 10000 and x1.5 is 15000)

amountOutMin minimum allowed number of received position tokens after opening (if the exchange returns less during the opening - the transaction will be rejected)

lendable is an address of lendable token

proxy is an address of proxy token (should be address(0) if direct swap)

tradable is an address of tradable token if position is long, overwise is shortable

trader is an address of position holder

deadline deprecated field

referrer is an address of position holder referrer (should be address(0) if no referrer)

guarded a signed message from the oracle with the expected value of the asset (protection against flash-loan attacks)

terminationConditions user-signed position auto termination conditions (can be initialized with zeros to cancel auto termination)

terminationReward amount in native tokens to compensate for the gas and work of the termination bot (must be added to msg.value)

convertFromNative If lendable token is wrapped native currency (e.g. BNB in BNB Chain), can pass the amount as transaction value and setting convertFromNative as true to wrap the native currency into ERC20 token

OpenShortPositionRequest

📄 Transaction configuration parameters of short position opening

Developer should use pragma experimental ABIEncoderV2; to pack struct to calldata with struct Developer should call PriceSigner service to obtain guarded field data before call open position

amountIn number of lendable tokens (stablecoin) to open a position and to be used as collateral for the position

baseBorrowAmount base loan. Calculated as baseBorrowAmount *leverageFactor = loan, where loan * tradablePrice <= amountInleverageFactor determines the leverage of the position (specified in decimals, i.e. x1 is 10000 and x1.5 - 15000)

amountOutMin minimum allowed number of received position tokens after opening (if the exchange returns less during the opening - the transaction will be rejected)

lendable is an address of lendable token

proxy is an address of proxy token (should be address(0) if direct swap)

tradable is an address of tradable token if position is long, overwise is shortable

trader is an address of position holder

➡ deadline deprecated field referrer is an address of position holder

referrer (should be address(0) if no referrer)

guarded a signed message from the oracle with the expected value of the asset (protection against flash-loan attacks)

terminationConditions user-signed position auto termination conditions (can be initialized with zeros to cancel auto termination)

terminationReward amount in native tokens to compensate for the gas and work of the termination bot (must be added to msg.value)

convertFromNative If lendable token is wrapped native currency (e.g. BNB in BNB Chain), can pass the amount as transaction value and setting convertFromNative as true to wrap the native currency into ERC20 token

WithdrawRequest

📄 Withdrawal parameters from the reserve All ib tokens support EIP-2612 for disbursement via offchain signature, not approve transaction

Last updated