Liquidity Mining Pool

There are three liquidity pool contracts for APY.Finance. Each contract handles a specific currency and issues its own APT token to represent a user’s stake in the pool. There is a contract for DAI, USDC, and USDT. These contracts are orchestrated by the APY manager to act as a single pool.

The liquidity pool contracts use a proxy pattern for upgradeability. Transactions are sent to the proxy contract address, but the functions they call are from the implementation contract.

Each pool contract is also an ERC-20 token with 18 decimals and the symbol “APT”. The contract is called APYPoolToken.

All of the following examples will use web3.js and the DAI liquidity pool contract.

Adding Liquidity

The transaction sender must first approve the pool proxy contract to transfer their deposit tokens:

await daiToken.methods.approve(daiPoolToken.address, daiBalance);

Then the sender must call the addLiquidity function on the pool contract with the amount of tokens they wish to deposit:

await daiPoolToken.methods.addLiquidity(daiBalance);

Removing Liquidity

The transaction sender must first approve the pool proxy contract to transfer their APT tokens:

await daiAptToken.methods.approve(
    daiPoolToken.address,
    daiAptBalance
);

APT represents a share of the pool. The total supply of APT represents the total amount of stablecoin deposited in the pool contract.

Then the sender must call the redeem function on the pool contract with the amount of APT the wish to redeem:

await daiPoolToken.redeem(daiAptBalance);

Redeeming the entire balance of APT will withdraw the sender’s entire deposit.

Contract Addresses

Mainnet

Kovan

The contracts deployed to Kovan use the DAI, USDC, and USDT tokens available from the Aave faucet.

APYPoolToken ABI

https://gist.github.com/opz/9d07671b0bc978aba5251e3183bc890c

Last updated