trade()

    function trade(Token token, uint128 targetAmount) external payable;

This function will allow anyone to trade the existing tokens held by the contract at the indicated price available in the contract at the moment of execution.

Currently, ETH is paired with BNT while all other tokens are paired with ETH.

It is recommended to first identify the current price using the relevant read functions

Function Arguments

Name
Type
Description

token

Token

The token address of the token you would like to trade out of the contract

targetAmount

uint128

The amount of target tokens you would like to trade out of the contract

Example

trade(
0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c, //token address
1000000000000000000000 //token amount indicated in the token wei 
)

During function execution, the required source token amount would be deducted from the caller wallet in return for the target token amount the caller is asking to trade out of the contract.

Approve is required for this transaction

Last updated