Phantazm
  • Intro
    • What is Phantazm?
  • V2
    • TVL & Emission Sustainability
    • Two Token Model
    • Supplying assets into LPs
    • Staking Mechanism(Soon)
  • The Core Protocol
    • Protocol Overview
    • LendingPool
      • ILendingPool
    • Addresses Provider
      • ILendingPoolAddressesProvider
    • Addresses Provider Registry
      • ILendingPoolAddressesProviderRegistry
    • Protocol Data Provider
      • IProtocolDataProvider
    • aTokens (TBD)
      • IAToken
    • Debt Tokens
      • IStableDebtToken
      • IVariableDebtToken
    • Phantazm Token (TBD)
    • Price Oracle
      • IPriceOracle
  • Deployed Contracts
    • Main market (TBD)
  • Getting Started
    • SDKs
    • Subgraph data (GraphQL)
    • Gas Limits
  • Guides
    • APY and APR
    • Liquidity Mining
    • Flash Loans
      • IFlashLoanReceiver
    • Liquidations
    • Troubleshooting Errors
  • Security & Audits
  • Glossary
  • Socials
Powered by GitBook
On this page
  • Integration Guide
  • 0. Prerequisites
  • 1. Check the user(s) reward balance
  • 2. Claim the accrued rewards
  • 3. Consider the token that is rewarded
  • 4. Calculating Incentives APY
  • Methods
  • claimRewards()
  • claimRewardsOnBehalf()
  • setClaimer()
  • View Methods
  • getAssetData**()**
  • getClaimer**()**
  • getRewardsBalance**()**
  • getUserAssetData**()**
  • getUserUnclaimedRewards**()**
  • getDistributionEnd**()**
  1. Guides

Liquidity Mining

PreviousAPY and APRNextFlash Loans

Last updated 1 year ago

Liquidity mining/incentives was implemented in the Main Phantazm Market via , enabling incentives for both depositing and borrowing. Incentives are also currently implemented on the Polygon market & Avalanche market, using the same implementation details as described on this page.

Market
Code
Address

Main Market

Polygon Market

Avalanche

Integration Guide

0. Prerequisites

Your user(s) should already have a position in the protocol. Depending on the market and incentives that are enabled, they should already have a , , or both, in one of the incentivised assets.

To check if an asset is current incentivised, use the method, passing in the associated aToken or debtToken address of the incentivised asset. To get a list of associated tokens per asset, see also in the Protocol Data Provider.

1. Check the user(s) reward balance

Call the method, passing in the relevant token addresses (aTokens and/or debtTokens) as an array.

2. Claim the accrued rewards

2.1 Claim rewards from the user

Call the method, passing in the relevant token addresses (aTokens and/or debtTokens) as an array. The msg.sender must match the user's address that has accrued the rewards.

2.2 Claim rewards on behalf of the user

3. Consider the token that is rewarded

For the main market, stkPhantazm is rewarded and automatically accrues interest based on the Staking Phantazm parameters once claimed. There is an associated 10 day cool down period to convert stkPhantazm to Phantazm, with a 2 day redeem period to do so. Ensure that this information is presented to the user and handled correctly.

4. Calculating Incentives APY

APY = normalizedEmissionPerSecond * rewardTokenPriceInEth * SECONDS_PER_YEAR / normalizedTotalTokenSupply

Note:

  • normalizedEmissionPerSecond = emissionPerSecond/RWARD_TOKEN_DECIMALS

  • Reward Token is Phantazm for mainnet and Matic for polygon.

  • normalizedTotalTokenSupply = tokenTotalSupplyNormalized * tokenPriceInEth,where token is the incentivized a/s/v token and token price is same as underlying asset's price.

Methods

claimRewards()

function claimRewards(address[] calldata assets, uint256 amount, address to)

Claims the accrued rewards for the assets, accumulating any pending rewards.

Parameter Name
Type
Description

assets

address[]

addresses of the asset that accrue rewards, i.e. aTokens or debtTokens.

To get a list of associated tokens per asset, see also see getReserveTokensAddresses() in the Protocol Data Provider.

amount

uint256

amount to claim, expressed in wei

to

address

address where the claimed rewards will be sent

claimRewardsOnBehalf()

function claimRewardsOnBehalf(address[] calldata assets, uint256 amount, address user, address to)

Claims the accrued rewards for the assets, accumulating any pending rewards, on behalf of user.

Parameter Name
Type
Description

assets

address[]

addresses of the asset that accrue rewards, i.e. aTokens or debtTokens.

To get a list of associated tokens per asset, see also getReserveTokensAddresses() in the Protocol Data Provider.

amount

uint256

amount to claim, expressed in wei

user

address

address of the user who has pending rewards to claim

to

address

address where the claimed rewards will be sent

setClaimer()

function setClaimer(address user, address caller)

Sets an authorised caller to claim all rewards on behalf of the user. This can only be set via Governance.

Parameter Name
Type
Description

user

address

address of the user who has pending rewards

caller

address

address of the new authorised claimer

View Methods

getAssetData**()**

getAssetData()is currently available only on ethereum markets. In case you are working on Polygon markets (main or mumbai), please read data from the public mapping assetsdirectly 😅

function getAssetData(address asset)

Returns the asset index, the emissions per second (i.e. current rewards rate), and the last updated timestamp.

Parameter Name
Type
Description

asset

address

address of the asset that accrue rewards, i.e. aTokens or debtTokens.

To get a list of associated tokens per asset, see also getReserveTokensAddresses() in the Protocol Data Provider.

getClaimer**()**

function getClaimer(address user)

Parameter Name
Type
Description

user

address

address of the authorised claimer

getRewardsBalance**()**

function getRewardsBalance(address[] assets, address user)

Returns the total rewards of user for assets.

Parameter Name
Type
Description

assets

address[]

addresses of the asset that accrue rewards, i.e. aTokens or debtTokens.

To get a list of associated tokens per asset, see also getReserveTokensAddresses() in the Protocol Data Provider.

user

address

address of the user who has pending rewards to claim

getUserAssetData**()**

function getUserAssetData(address user, address asset)

Returns the data of user on a distribution from asset

Parameter Name
Type
Description

user

address

address of the user

asset

address

address of the asset that accrue rewards, i.e. aTokens or debtTokens.

To get a list of associated tokens per asset, see also getReserveTokensAddresses() in the Protocol Data Provider.

getUserUnclaimedRewards**()**

function getUserUnclaimedRewards(address user)

Returns the unclaimed accumulated rewards of user for their last action in the protocol.

Parameter Name
Type
Description

user

address

address of the user

getDistributionEnd**()**

function getDistributionEnd()

Returns the end of the distribution period

A claimer must have been set via the method, enabling the caller to claim on the user's behalf.

Call the method, passing in the relevant token addresses (aTokens and/or debtTokens) as an array. The msg.sender must have been previously set via .

For the Polygon market, WMATIC is rewarded with no 'lock up' period. Ensure that you account for the difference between WMATIC and the native MATIC, specifically that WMATIC needs to be unwrapped to MATIC. This can be done by calling on the WMATIC contract.

You can get price for reward token as well as reserve token from

The user must have previously called , setting the msg.sender as the approved claimer.

Returns the authorised claimer of user's accrued rewards. See also .

withdraw()
setClaimer()
claimRewardsOnBehalf()
setClaimer()
setClaimer()
setClaimer()
AIP-16
getReserveTokensAddresses()
getAssetData()
getRewardsBalance()
claimRewards()
PhantazmPriceOracle
deposit
borrow