SwapPair
These contracts manage liquidity pools
Each of our Swap Pairs is build with our stablecoin aUSD and one of our stock tokens. The SwapPair contract is similar to Uniswap V2 Pair.
For subgraph, you can track the events:
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
uint amount0InFee,
uint amount1InFee,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);Base Info
token0
function token0() external view returns (address);Always returns the address of aUSD
token1
Returns the address of the paired stock token.
getReserves
Returns the reserves of token0 and token1 used to price trades and distribute liquidity. Also returns the block.timestamp of the last block during which an interaction occured for the pair.
getSwapFee
Given the reserves after a swap, it will return the swap feePecentage including dynamic fee (1e18 = 100%). isUsablePrice0 indicates if oracle is up-to-date and should always be true (as we update oracle in regular intervals).
Last updated