Pool
This contract implements the core algorithm of Speculative AMM and on-chain liquidity management functionality.
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.
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.
The following token pools have been implemented upon the launch of DEXG Exchange.
Token | Pool address |
DEXG |
New pools are created by the community governance. For a description on how to do so, please refer to governance.
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).
Function |
function initialize(
address _token0,
uint _Ct,
uint _Nt,
uint price
)
Initializes the staking pool which should be invoked by the DEXToken factory contract.
getToken()
returns (address)
A pool contains one token. Returns the token smart contract address.
initialize(
address _token0,
address _token1,
uint _Pt
)
mean()
getLastUpdateTime()
getCirculatingSupply()
getUserbase()
getPrice()
updateAMM()
getSpotPrice(
uint _Ct,
uint _Nt
)
getToken()
getPoolBalance()
getTotalLiquidity()
liquidityOf(
address account
)
returns (uint)
Returns user's pool liquidity.
liquiditySharesOf(
address account
)
liquidityTokenToAmount(
uint token
)
liquidityFromAmount(
uint amount
)
deposit(
uint amount
)
Deposit an amount to the pool.
withdraw(
uint amount
)
Withdraw an amount from the pool.
function swapExactETHForTokens(
uint amountIn,
uint minAmountOut,
uint maxPrice,
uint deadline
)
function swapExactTokensForETH(
uint amountIn,
uint minAmountOut,
uint minPrice,
uint deadline
)
Last modified 1yr ago