Uniswap
Information on Uniswap protocol and Defire's operations that interact with it.

Overview

Uniswap is an automated liquidity protocol. More specific, it is an completely on-chain decentralized Ethereum-based protocol that is designed to facilitate automatic digital asset exchange between ETH and ERC20 tokens. Visit this site for more information on Compound protocol.

Operations

Trade DAI for ETH

In Assets: DAI Out Assets: ETH
A trader supplies DAI and receives ETH in exchange based on Uniswap exchange rate.
JavaScript & Node
1
const operation = new defire.Operations.Uniswap.Trade.DAI.For.ETH({
2
amountDAI: "5000000000000000000" //5 DAI
3
});
Copied!
Constructor object fields
amountDAI required string | number | JSBI
Total number of DAI to exchange in wei format
deadline optional number
Time in seconds after the operation cannot longer be executed. Default 5 minutes.
minETH optional string | number | JSBI
Minimum amount of ETH to obtain in wei format. Default 1.
Returns
Creates a new operation object

Trade ETH for DAI

In Assets: ETH Out Assets: DAI
A trader supplies ETH and receives DAI in exchange based on Uniswap exchange rate.
JavaScript & Node
1
const operation = new defire.Operations.Uniswap.Trade.ETH.For.DAI({
2
amountETH: "1500000000000000000" //1.5 ETH
3
});
Copied!
Constructor object fields
amountETH required string | number | JSBI
Total number of ETH to exchange in wei format.
deadline optional
Time in seconds after the operation cannot longer be executed. Default 5 minutes.
minDAI optional string | number | JSBI
Minimum amount of DAI to obtain in wei format. Default 1.
Returns
Creates a new operation object

Trade USDC for ETH

In Assets: USDC Out Assets: ETH
A trader supplies USDC and receives ETH in exchange based on Uniswap exchange rate.
JavaScript & Node
1
const operation = new defire.Operations.Uniswap.Trade.USDC.For.ETH({
2
amountUSDC: "5000000000000000000" //5 USDC
3
});
Copied!
Constructor object fields
amountUSDC required string | number | JSBI
Total number of USDC to exchange in wei format
deadline optional number
Time in seconds after the operation cannot longer be executed. Default 5 minutes.
minETH optional string | number | JSBI
Minimum amount of ETH to obtain in wei format. Default 1.
Returns
Creates a new operation object

Trade ETH for USDC

In Assets: ETH Out Assets: USDC
A trader supplies ETH and receives USDC in exchange based on Uniswap exchange rate.
JavaScript & Node
1
const operation = new defire.Operations.Uniswap.Trade.ETH.For.USDC({
2
amountETH: "1500000000000000000" //1.5 ETH
3
});
Copied!
Constructor object fields
amountETH required string | number | JSBI
Total number of ETH to exchange in wei format.
deadline optional
Time in seconds after the operation cannot longer be executed. Default 5 minutes.
minUSDCoptional string | number | JSBI
Minimum amount of USDC to obtain in wei format. Default 1.
Returns
Creates a new operation object

Trade WBTC for ETH

In Assets: WBTC Out Assets: ETH
A trader supplies WBTC and receives ETH in exchange based on Uniswap exchange rate.
JavaScript & Node
1
const operation = new defire.Operations.Uniswap.Trade.WBTC.For.ETH({
2
amountWBTC: "5000000000000000000" //5 WBTC
3
});
Copied!
Constructor object fields
amountWBTC required string | number | JSBI
Total number of WBTC to exchange in wei format
deadline optional number
Time in seconds after the operation cannot longer be executed. Default 5 minutes.
minETH optional string | number | JSBI
Minimum amount of ETH to obtain in wei format. Default 1.
Returns
Creates a new operation object

Trade ETH for WBTC

In Assets: ETH Out Assets: WBTC
A trader supplies ETH and receives WBTC in exchange based on Uniswap exchange rate.
JavaScript & Node
1
const operation = new defire.Operations.Uniswap.Trade.ETH.For.WBTC({
2
amountETH: "1500000000000000000" //1.5 ETH
3
});
Copied!
Constructor object fields
amountETH required string | number | JSBI
Total number of ETH to exchange in wei format.
deadline optional
Time in seconds after the operation cannot longer be executed. Default 5 minutes.
minWBTC optional string | number | JSBI
Minimum amount of WBTC to obtain in wei format. Default 1.
Returns
Creates a new operation object
Last modified 1yr ago