DEXToken
Search…
Pool
This contract implements the core algorithm of Speculative AMM and on-chain liquidity management functionality.

Overview

DEXG Pools are used to deposit and withdraw liquidity on DEXG Exchange, serving as the counterparty to be traded against, slightly comparable to orders in an order-book on centralised exchanges.
The primary function of pools on DEXG Pool is to maintain the volatility factors used for the algorithmic functions of the sAMM to evaluate token-pricing.
Via the Factory contract, new token pools can be created.

Single-token pools

The sAMM implemented on DEXG Pool allows the usage of single-token pools, which obliges liquidity providers to only submit the token they hold to the pool. Each pool is backed by a corresponding WETH pool, which is used by the algorithmic pricing mechanism as well.
Users can buy tokens directly from the pool in exchange for WETH, filling the corresponding WETH pool. On a token to token swap, a corresponding amount of the backing WETH pool will be moved to the token pool that has been swapped out from the token pool that has been swapped in.

Implemented launch pools

The following token pools have been implemented upon the launch of DEXG Exchange.
New pools are created by the community governance. For a description on how to do so, please refer to governance.

Providing pool liquidity

Providing liquidity on DEXG Pool is a straight forward process. Users which hold a token that has an active DEXG Pool contract can navigate to the corresponding pool on DEXG Exchange.
After approving the contract (1), the token can be deposited to the pool (2). In return, the liquidity provider will get DEXG-LP tokens. The DEXG-LP tokens will are minted by the pool on providing liquidity and burned on withdrawing liquidity from the pool. Withdrawing works in the same manner by navigating to 'Remove' (3).

API

Functions

Controller and View Functions

initialize

1
function initialize(
2
address _token0,
3
uint _Ct,
4
uint _Nt,
5
uint price
6
)
Copied!
Initializes the staking pool which should be invoked by the DEXToken factory contract.

getToken

1
getToken()
2
returns (address)
Copied!
A pool contains one token. Returns the token smart contract address.

Speculative AMM

initialize

1
initialize(
2
address _token0,
3
address _token1,
4
uint _Pt
5
)
Copied!

mean

1
mean()
Copied!

getLastUpdateTime

1
getLastUpdateTime()
Copied!

getCirculatingSupply

1
getCirculatingSupply()
Copied!

getUserbase

1
getUserbase()
Copied!

getPrice

1
getPrice()
Copied!

updateAMM

1
updateAMM()
Copied!

getSpotPrice

1
getSpotPrice(
2
uint _Ct,
3
uint _Nt
4
)
Copied!

getToken

1
getToken()
Copied!

Pool Management

getPoolBalance

1
getPoolBalance()
Copied!

getTotalLiquidity

1
getTotalLiquidity()
Copied!

liquidityOf

1
liquidityOf(
2
address account
3
)
4
returns (uint)
Copied!
Returns user's pool liquidity.

liquiditySharesOf

1
liquiditySharesOf(
2
address account
3
)
Copied!

liquidityTokenToAmount

1
liquidityTokenToAmount(
2
uint token
3
)
Copied!

liquidityFromAmount

1
liquidityFromAmount(
2
uint amount
3
)
Copied!

deposit

1
deposit(
2
uint amount
3
)
Copied!
Deposit an amount to the pool.

withdraw

1
withdraw(
2
uint amount
3
)
Copied!
Withdraw an amount from the pool.

Trading Functions

swapExactETHForTokens

1
function swapExactETHForTokens(
2
uint amountIn,
3
uint minAmountOut,
4
uint maxPrice,
5
uint deadline
6
)
Copied!

swapExactTokensForETH

1
function swapExactTokensForETH(
2
uint amountIn,
3
uint minAmountOut,
4
uint minPrice,
5
uint deadline
6
)
Copied!
Last modified 6mo ago