Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
The pool.sol
contract is the main user facing contract of the protocol. It exposes the liquidity management methods that can be invoked using either Solidity or Web3 libraries.
The referralCode
is emitted in Supply event and can be for third party referral integrations. To activate referral feature and obtain a unique referral code, integrators need to submit proposal to Themis Governance.
When supplying, the Pool contract must have** allowance()
to spend funds on behalf of msg.sender ** for at-least** amount ** for the** asset **being supplied. This can be done via the standard ERC20 approve()
method on the underlying token contract
Referral supply is currently inactive, you can pass 0 as referralCode . This program may be activated in the future through an Themis governance proposal
asset
address
address of the asset being supplied to the pool.
amount
uint256
amount of asset being supplied.
onBehalfOf
address
address that will receive the corresponding aTokens. Note: only the onBehalfOf address will be able to withdraw asset from the pool.
referralCode
uint16
unique code for 3rd party referral program integration. Use 0 for no referral.
Supply with transfer approval of supplied asset via permit function. This method removes the need for separate approval tx before supplying asset to the pool.
Permit signature must be signed by msg.sender with spender as Pool address.
Referral program is currently inactive, you can pass 0 as referralCode . This program may be activated in the future through an Themis governance proposal
asset
address
Address of underlying asset being supplied. Same asset as used in permit s,v,r
amount
uint256
Amount of asset to be supplied and signed for approval. Same amount as used in permit s,v,r
onBehalfOf
address
Address that will receive the aTokens.
referralCode
uint16
unique code for 3rd party referral program integration. Use 0 for no referral.
deadline
uint256
unix timestamp up-till which signature will be valid
permitV
uint8
Signature parameter v
permitR
bytes32
Signature parameter r
permitS
bytes32
Signature parameter s
Withdraws amount
of the underlying asset
, i.e. redeems the underlying token and burns the tTokens.
If user has any existing debt backed by the underlying token, then the maxamountavailable to withdraw is theamount that will not leave user health factor < 1 after withdrawal.
When withdrawing to another address, msg.sender should have aToken that will be burned by Pool .
asset
address
address of the underlying asset, not the aToken amount uint256 amount deposited, expressed in wei units. Use type(uint).max
to withdraw the entire balance.
to
address
address that will receive the asset
Borrows amount
of asset
with interestRateMode
, sending the amount to msg.sender
, with the debt being incurred by onBehalfOf
.
Note: If onBehalfOf
is not same as msg.sender , then onBehalfOf
must have supplied enough collateral via supply()
and have delegated credit to msg.sender
via approveDelegation()
.
Referral program is currently inactive, you can pass 0 as referralCode
. This program may be activated in the future through an Aave governance proposal
asset
address
address of the underlying asset
amount
uint256
amount to be borrowed, expressed in wei units
interestRateMode
uint256
the type of borrow debt. Stable: 1, Variable: 2
referralCode
uint16
referral code for our referral program. Use 0 for no referral code.
onBehalfOf
address
address of user who will incur the debt. Use msg.sender when not calling on behalf of a different user.
Repays onBehalfOf
's debt amount
of asset
which has a rateMode
.
When repaying, the Pool contract must have** allowance()
to spend funds on behalf of msg.sender
** for at-least** amount ** for the** asset **you are repaying with. This can be done via the standard ERC20 approve()
method on the underlying token contract.
Referral program is currently inactive, you can pass 0 as referralCode
. This program may be activated in the future through an Themis governance proposal
asset
address
address of the underlying asset
amount
uint256
amount to be borrowed, expressed in wei units. Use uint(-1) to repay the entire debt, ONLY when the repayment is not executed on behalf of a 3rd party. In case of repayments on behalf of another user, it's recommended to send an _amount slightly higher than the current borrowed amount.
rateMode
uint256
the type of debt being repaid. Stable: 1, Variable: 2
onBehalfOf
address
address of user who will incur the debt. Use msg.sender when not calling on behalf of a different user.
Repay with transfer approval of borrowed asset via permit function. This method removes the need for separate approval tx before repaying asset to the pool.
Permit signature must be signed by msg.sender
with spender value as Pool address.
asset
address
Address of underlying asset being supplied. Same asset as used in permit s,v,r
amount
uint256
Amount of asset to be supplied and signed for approval. Same amount as used in permit s,v,r
interestRateMode
uint256
the type of debt being repaid. Stable: 1, Variable: 2
onBehalfOf
address
Address that will receive the aTokens.
deadline
uint256
unix timestamp up-till which signature will be valid
permitV
uint8
Signature parameter v
permitR
bytes32
Signature parameter r
permitS
bytes32
Signature parameter s
Allows user to repay with tTokens of the underlying debt asset without any approvals eg. Pay DAI debt using tDAI tokens.
asset
address
Address of the underlying asset to be repaid
amount
uint256
Amount of underlying asset being repaid. Use uint256(-1) to pay without leaving tToken dust
interestRateMode
uint256
Interest rate mode of the debt position 1 - stable 2 - variable
Swaps msg.sender
's borrow rate mode between stable and variable.
asset
address
address of the underlying asset
rateMode
uint256
the rate mode the user is swapping from. Stable: 1, Variable: 2
function rebalanceStableBorrowRate(address asset, address user)
Rebalances stable borrow rate of the user
for given asset
. In case of liquidity crunches on the protocol, stable rate borrows might need to be rebalanced to bring back equilibrium between the borrow and supply rates.
asset
address
Address of the underlying token that has been borrowed for which the position is being rebalanced.
user
address
Address of the user being rebalanced.
Sets the asset of msg.sender
to be used as collateral or not.
An asset in Isolation Mode can be enabled to use as collateral only if no other asset is already enabled to use as collateral.
An asset in Isolation Mode can be enabled to use as collateral only if no other asset is already enabled to use as collateral.
User won’t be able to disable an asset as collateral if they have an outstanding debt position which could be left with Loan risk > 1/HEALTH_FACTOR_LIQUIDATION_THRESHOLD on disabling the given asset as collateral.
asset
address
address of the underlying asset to be used as collateral
useAsCollateral
bool
true if the asset should be used as collateral
When the Loan Risk of a position is greater than 100% (Loan Risk=1/health factor), the liquidator repays part or all of the outstanding loan amount on behalf of the borrower, while the liquidator receives a discounted amount of collateral in return (also known as Liquidation Bonus). In M0, the liquidator can decide whether it wants to receive the relevant amount of tToken instead of the underlying asset. When the liquidation is successfully completed, the Loan Risk of the position is reduced, bringing the Loan Risk below 100%.
Liquidators can only close a certain amount of collateral defined by a close factor. Currently the close factor is 0.5. In other words, liquidators can only liquidate a maximum of 50% of the amount pending to be repaid in a position. The liquidation discount applies to this amount.
Liquidators must approve()
the Pool
contract to use debtToCover
of the underlying ERC20 of theasset
used for the liquidation.
NOTES
In most scenarios, profitable liquidators will choose to liquidate as much as they can (50% of the user position).
debtToCover parameter can be set to uint(-1)
and the protocol will proceed with the highest possible liquidation allowed by the close factor.
To check a user's health factor, use getUserAccountData()
collateral
address
address of the collateral reserve
debt
address
address of the debt reserve
user
address
address of the borrower
debtToCover
uint256
amount of asset debt that the liquidator will repay
receivetToken
bool
if true, the user receives the tTokens equivalent of the purchased collateral. If false, the user receives the underlying asset directly.
Allows users to access liquidity of the pool for givenlist of assets for one transactionas long as the amount taken plus fee is returned or debt position is opened by the end of transaction. If no debt position is opened, receiver must approve thePoolcontract for at least theamount borrowed + fee, else transaction will revert.
Flash loan fee is waived for the approvedflashBorrowers
Referral program is currently inactive, you can pass 0 as referralCode . This program may be activated in the future through an Aave governance proposal
receiverAddress
address
Address of the contract that will receive the flash borrowed funds. Must implement the IFlashLoanReceiver interface.
assets
address[]
Addresses of the underlying assets that will be flash borrowed
amounts
uint256[]
Amounts of assets being requested for flash borrow. This needs to contain the same number of enteries as assets.
modes
uint256[]
the types of debt position to open if the flashloan is not returned. 0: no open debt. (amount+fee must be paid in this case or revert) 1: stable mode debt 2: variable mode debt
onBehalfOf
address
if the associated mode is not0 then the incurred debt will be applied to the onBehalfOfaddress.
Note: onBehalfOf
must already have approved sufficient borrow allowance
of the associated asset to msg.sender
params
bytes
Arbitrary bytes-encoded params that will be passed to executeOperation() method of the receiver contract.
referralCode
uint16
Referral Code used for 3rd party integration referral. The unique referral id is can be requested via governance proposal
Allows users to access liquidity of one reserve or one transaction as long as the amount taken plus fee is returned.
Receiver must approve thePoolcontract for at least the*amount borrowed + fee,*else transaction will revert.
Does not waive few for approvedflashBorrowersnor allow opening a debt position instead of repaying.
Referral program is currently inactive, you can pass 0 as referralCode . This program may be activated in the future through an Aave governance proposal
receiverAddress
address
Address of the contract that will receive the flash borrowed funds. Must implement the IFlashLoanReceiver interface.
asset
address
Address of the underlying asset that will be flash borrowed.
amount
uint256
Amount of asset being requested for flash borrow
params
bytes
Arbitrary bytes-encoded params that will be passed to executeOperation() method of the receiver contract.
referralCode
uint16
Referral Code used for 3rd party integration referral. The unique referral id is can be requested via governance proposal
Mints reserve income accrued to treasury (as per the reserve factor) for the given list of assets.
assets
address[]
List of assets for which accrued income is minted
Updates the user efficiency mode category. The category id must be a valid id already defined byPool or Risk Admins
Will revert if user is borrowing non-compatible asset or change will drop HF < HEALTH_FACTOR_LIQUIDATION_THRESHOLD
Will revert if user is borrowing non-compatible asset or change will drop HF < HEALTH_FACTOR_LIQUIDATION_THRESHOLD
categoryId
uint8
eMode category id (0 - 255) defined by Risk or Pool Admins. categoryId == 0 ⇒ non E-mode category.
Allows contracts, with BRIDGE role permission, to mint unbackedtTokensto the onBehalfOf address. This method is part of the V2 Portal feature.
Only available to the addresses with BRIDGE role. Bridge addresses can be whitelisted by the governance(still in building).
asset
address
address of the underlying asset token
amount
uint256
the amount to be minted
onBehalfOf
address
the address which will receive the aTokens
referralCode
uint16
Code used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-man
Allows contracts, with BRIDGE role permission, to back the currently unbacked aTokens with amount of underlying asset and pay fee . This method is part of the V2 Portal feature.
Only available to the addresses with BRIDGE role. Bridge addresses can be whitelisted by the governance.
asset
address
address of the underlying asset to repay
amount
uint256
amount of asset supplied to back the unbacked tokens
fee
uint256
amount paid in fee
Rescue and transfer tokens locked in this contract.
Only available to POOL_ADMIN role. Pool admin is selected by the governance.
M1's assets will be authorized to borrow assets from the Pool contract when they need to borrow assets. M1's collateral will be pledged directly in the tToken contract. a single class of M1's assets has a maxBorrowLimitInBaseCurrency(eg. Uniswap-V3-POS-wETH/USDC-500 can only borrow $1M value of asset from M0 Pool) . Therefore this class of assets is also limited to the assets that can be borrowed from the Pool contract.
Available only for M1 Pool calls
There are different outcomes for users who partially repay or fully repay their debt in M1, with full repayment allowing for direct redemption of the collateral.
Available only for M1 Pool calls
When the Loan Risk of a debit order in M1 is greater than 100% {(loan risk in M1=Outstandingdebtvalue/(assetValue*liquidationThreshold)} . The liquidator repays the entire outstanding amount on behalf of the borrower. At the same time the liquidator gets a discount on the collateral as a return. In M1, there is no LiquidationBonus set, and the liquidator is expected to receive a reward of approximately (1 - liquidationThreshold)*CollateralValue. When the liquidation is completed. The order will be settled.
Available only for M1 Pool calls
The discounted collateral which are given to liquidator is usually LP assets or other types of Yield Bearing Token that need to be redeemed on their own.
Earnings from past time in the collateral(fees, yield, reward etc. ) are not calculated into the collateral value, so liquidation may result in a higher than expected award.
Returns the state and configuration of the reserve.
asset
address
address of the underlying reserve asset.
configuration
uint256
Reserve configuration. bit 0-15: LTV bit 16-31: Liquidation threshold bit 32-47: Liquidation bonus bit 48-55:Decimals bit 56: reserve is active bit 57: reserve is frozen bit 58: borrowing is enabled bit 59: stable rate borrowing enabled bit 60: asset is paused bit 61: borrowing in isolation mode is enabled bit 62-63: reserved bit 64-79: reserve factor bit 80-115: borrow cap in whole tokens, 0 ⇒ no cap bit 116-151: supply cap in whole tokens, 0 ⇒ no cap bit 152-167: liquidation protocol fee bit 168-175: eMode category bit 176-211: unbacked mint cap in whole tokens, 0 ⇒ no cap bit 212-251: debt ceiling for isolation mode with decimals bit 252-255: unused
liquidityIndex
uint128
yield generated by reserve during time interval since lastUpdatedTimestamp. Expressed in ray
currentLiquidityRate
uint128
current supply rate. Expressed in ray
variableBorrowIndex
uint128
yield accrued by reserve during time interval since lastUpdatedTimestamp. Expressed in ray
currentVariableBorrowRate
uint128
current variable borrow rate. Expressed in ray
currentStableBorrowRate
uint128 current stable borrow rate. Expressed in ray
lastUpdateTimestamp
uint40
timestamp of when reserve data was last updated. Used for yield calculation.
id
uint16
reserve’s position in the list of active reserves.
aTokenAddress
address
address of associated aToken
stableDebtTokenAddress
address
address of associated stable debt token
variableDebtTokenAddress
address
address of associated variable debt token
interestRateStrategyAddress
address
address of interest rate strategy.
accruedToTreasury
uint128
the current treasury balance (scaled)
unbacked
uint128
the outstanding unbacked aTokens minted through the bridging feature
isolationModeTotalDebt
uint128
the outstanding debt borrowed against this asset in isolation mode
Returns the user account data across all the reserves
user
address
address of the user
totalCollateralBase
uint256
total collateral of the user, in market’s base currency
totalDebtBase
uint256
total debt of the user, in market’s base currency
availableBorrowsBase
uint256
borrowing power left of the user, in market’s base currency
currentLiquidationThreshold
uint256
liquidation threshold of the user
ltv
uint256
Loan To Value of the user
healthFactor
uint256
current health factor of the user
Returns the configuration of the reserve.
asset
address
address of the underlying reserve asset.
configuration
uint256
Reserve configuration. bit 0-15: LTV bit 16-31: Liquidation threshold bit 32-47: Liquidation bonus bit 48-55: Decimals bit 56: reserve is active bit 57: reserve is frozen bit 58: borrowing is enabled bit 59: stable rate borrowing enabled bit 60: asset is paused bit 61: borrowing in isolation mode is enabled bit 62-63: reserved bit 64-79: reserve factor bit 80-115: borrow cap in whole tokens, 0 ⇒ no cap bit 116-151: supply cap in whole tokens, 0 ⇒ no cap bit 152-167: liquidation protocol fee bit 168-175: eMode category bit 176-211: unbacked mint cap in whole tokens, 0 ⇒ no cap bit 212-251: debt ceiling for isolation mode with decimals bit 252-255: unused
Returns the configuration of the user across all the reserves.
user
address
address of the user
uint256
Bitmap of the users collaterals and borrows. Its divided into pairs of bits, one pair for each asset. The first bit of the pair indicates if it is being used as collateral by the user, the second bit indicates if it is being borrowed. The corresponding assets are in the same position as getReservesList() For example, if the hex value returned is 0x40020, which represents a decimal value of 262176, then in binary it is 1000000000000100000. If we format the binary value into pairs, starting from the right, we get 1 00 00 00 00 00 00 10 00 00. If we start from the right and move left in the above binary pairs, the third pair is 10. Therefore the 1 indicates that third asset from the reserveList is used as collateral, and 0 indicates it has not been borrowed by this user.
Returns the ongoing normalized income for the reserve.
A value of 1e27 means there is no income. As time passes, the yield is accrued. A value of 2/*1e27 means for each unit of asset one unit of income has been accrued.
uint256
Normalized income, expressed in ray
Returns the ongoing normalized variable debt for the reserve.
A value of 1e27 means there is no debt. As time passes, the debt is accrued. A value of 2/*1e27 means that for each unit of debt, one unit worth of interest has been accumulated.
uint256
Normalized debt, expressed in ray
Returns the list of initialized reserves.
Returns category data for the given eModeCategory id.
uint16
loan to value (ltv) for the given eModeCategory id
uint16
liquidationThreshold for the given eModeCategory id
uint16
liquidationBonus for the given eModeCategory id
address
custom price source for the eMode category
string
custom label describing the eMode category
Returns eModeCategory Id of the user’s eMode. 0 ⇒ no eMode.
Returns the percent of total flashloan premium paid by the borrower. A part of this premium is added to reserve's liquidity index i.e. paid to the liquidity provider and the other part is paid to the protocol i.e. accrued to the treasury.
Returns the percent of flashloan premium that is accrued to the treasury.
Addresses register of the protocol for a particular market. This contract is immutable and the address will never change.
Whenever the `Pool` contract is needed, we recommended you fetch the correct address from the `PoolAddressesProvider` smart contract.
The source code can be found on Github
Fetch the market id of the associated Themis 2.0 market.
string
A string representation of the market
Fetch the address of the protocol contract stored at the given id.
id
bytes32
id. Example, the Protocol Data Provider uses id 0x1
address
The address associated with the bytes32 id passed
Fetch the contract of latest pool
address
The address of the associated Pool
Fetch the PoolConfigurator is used for configuration methods, like init reserves or update token implementation etc, of the market.
address
The address of associated market’s PoolConfigurator
function getPriceOracle() external view override returns (address)
Fetch Price Oracle used by the market.
address
The address of the price oracle used by associated market.
Fetch ACLManger that manages the system role of the market
address
The address of the ACLManger contract managing the system role of the associated market.
Fetch ACLAdmin of the market which holds the DEFAULT_ADMIN_ROLE in ACLManager.
address
The address of the access control list admin of the associated market.
address
The address of the Price oracle sentinel of the associated market.
Fetch address of latest pool data provider.
address
The address of the pool data provider of the associated market.
Fetch the contract of latest M1 pool
address
The address of the associated M1 Pool
Fetch the M1 PoolConfigurator is used for configuration methods, like init reserves or update token implementation etc, of the market.
address
The address of associated market’s M1 PoolConfigurator
M1 pool collateral calculation contract for M1 collateral value calculation
address
The address of associated market’s CollateralValueCalculator
newMarketId
string
The new id of the market
Sets the address of protocol contract stored at given id.
Eg. utils.keccak256(utils.toUtf8Bytes("INCENTIVES_CONTROLLER"))
is set to address of INCENTIVES_CONTROLLER
id
bytes32
keccak256 hash of UTF8Bytes string representing Contract
newAddress
address
The new address to be set corresponding to the id
Sets/updates the implementation address of a specific proxied protocol contract.
If there is no proxy registered with the given identifier, it creates the proxy setting newAddress as implementation and calls the initialize() function on the proxy
id
bytes32
id of Proxy contract
newImplementationAddress
address
The address of new implementation contract corresponding to the proxy
Sets/update the implementation of the POOL proxy contract.
newPoolImpl
address
The address of new Pool implementation contract
Sets/updates the implementation of the POOL_CONFIGURATOR proxy contract.
newPoolConfiguratorImpl
address
The address of new PoolConfigurator implementation contract
Sets/updates address of the PriceOracle contract.
newPriceOracle
address
The address of new PriceOracle contract
Sets/updates address of the AclAdmin.
newAclAdmin
address
The address of new AclAdming
Sets/updates address of the Price oracle sentinel.
newPriceOracleSentinel
address
The address of new PriceOracleSentinel
Sets/updates address of PoolDataProvider.
newDataProvider
address
The address of new PoolDataProvider
Sets/update the implementation of the POOL proxy contract.
newM1PoolImpl
address
The address of new M1Pool implementation contract
Sets/updates the implementation of the M1_POOL_CONFIGURATOR proxy contract.
newM1PoolConfiguratorImpl
address
The address of new M1PoolConfigurator implementation contract
Peripheral contract to collect and pre-process information from the Pool. Code available on github .
Returns list of the existing reserves in the pool.
string
The symbol of the underlying reserve asset
address
The address of the underlying reserve asset
Returns list of the existing tTokens in the pool.
string
The symbol of tToken of the reserve
address
The address of tToken of the reserve
Returns the configuration data of the reserve as described below:
asset
address
The address of the underlying asset of the reserve
uint256
The number of decimals of the reserve
uint256
The ltv of the reserve
uint256
The liquidationThreshold of the reserve
uint256
The liquidationBonus of the reserve
uint256
The reserveFactor of the reserve
bool
True if the usage as collateral is enabled, false otherwise
bool
True if borrowing is enabled, false otherwise
bool
True if stable rate borrowing is enabled, false otherwise
bool
True if reserve is active, false otherwise
bool
True if reserve is frozen, false otherwise
Returns reserve's efficiency mode category.
asset
address
The address of the underlying asset of the reserve
uint256
The number of decimals of the reserve
Returns the caps parameters of the reserve
asset
address
The address of the underlying asset of the reserve
uint256
The borrow cap of the reserve
uint256
The supply cap of the reserve
Returns true if the pool is paused.
asset
address
The address of the underlying asset of the reserve
bool
True if the pool is paused
Returns true if the asset is siloed for borrowing.
asset
address
The address of the underlying asset of the reserve
bool
True if the pool is paused
Returns the protocol fee on the liquidation bonus.
asset
address The address of the underlying asset of the reserve
uint256
The protocol fee on liquidation
Returns the unbacked mint cap of the reserve
asset
address
The address of the underlying asset of the reserve
uint256
The unbacked mint cap of the reserve
Returns the debt ceiling of the reserve
asset
address
The address of the underlying asset of the reserve Return Value
uint256
The debt ceiling of the reserve
Returns the debt ceiling decimals
uint256
The debt ceiling decimals
Returns the following reserve data 👇🏻
asset
address
The address of the underlying asset of the reserve
uint256
The amount of unbacked tTokens of the reserve
uint256
The scaled amount of tokens accrued to treasury that is to be minted
uint256
The total supply of the tToken
uint256
The total stable debt of the reserve
uint256
The total variable debt of the reserve
uint256
The liquidity rate of the reserve
uint256
The variable borrow rate of the reserve
uint256
The stable borrow rate of the reserve
uint256
The average stable borrow rate of the reserve
uint256
The liquidity index of the reserve
uint256
The variable borrow index of the reserve
uint40
The timestamp of the last update of the reserve
Returns the total supply of aTokens for a given asset
asset
address
The address of the underlying asset of the reserve
uint256
The total supply of the tToken
Returns the total debt for a given asset
asset
address
The address of the underlying asset of the reserve
uint256
The total debt (stable + variable) for an asset
Returns the following user reserve data
asset
address
The address of the underlying asset of the reserve
user
address
The address of the user
uint256
The current AToken balance of the user
uint256
The current stable debt of the user
uint256
The current variable debt of the user
uint256
The principal stable debt of the user
uint256
The scaled variable debt of the user
uint256
The stable borrow rate of the user
uint256
The liquidity rate of the reserve
uint40
The timestamp of the last update of the user stable rate
bool
True if the user is using the asset as collateral, else false
Returns the addresses of aToken, stableDebtToken and variableDebtToken of the reserve
asset
address
The address of the underlying asset of the reserve
address
The tToken address of the reserve
address
The StableDebtToken address of the reserve
address
The VariableDebtToken address of the reserve
Returns the address of the Interest Rate Strategy
asset
address
The address of the underlying asset of the reserve
address
The address of the Interest Rate strategy
Access Control List Manager is the main registry of system roles and permissions. ACLManager allows a Role Admin to manage roles. Role Admin is itself a role that is managed by the DEFAULT_ADMIN_ROLE.
DEFAULT_ADMIN_ROLE is held by the*ACLAdmin,*which is initialized in PoolAddressesProvider .
On Ethereum chain PoolAddressesProvider , is owned by Aave Governance. In networks other than Ethereum, either theCrosschain Governance BridgesorCommunity Multisigsare used to manage the PoolAddressesProvider .
Below we outline the powers/responsibilities of the roles and the specific methods that are only accessible to the holders of these roles.
FLASH_BORROWER
Flash loan premium is waived for the holders of this role. ⛔ Does not include flashLoanSimple
flashLoan
BRIDGE
Can leverage the Portal feature
mintUnbacked backUnbacked
ASSET_LISTING_ADMIN
Can update
asset oracle sources
fallback oracle
add new assets to the Aave market
setAssetSources
setFallbackOracle
initReserves
RISK_ADMIN
Can update
grace period of Oracle Sentinels
reserve params
unbacked mint cap
liquidation protocol fee
existing eMode categories and create new. (not category 0)
add/remove asset in silo mode
setGracePeriod
setReserveBorrowing
configureReserveAsCollateral
setReserveStableRateBorrowing
setReserveFreeze
setBorrowableInIsolation
setReserveFactor
setDebtCeiling
setBorrowCap
setSupplyCap
setLiquidationProtocolFee
setEModeCategory
setAssetEModeCategory
setUnbackedMintCap
setReserveInterestRateStrategyAddress
setSiloedBorrowing
ACL_ADMIN
Manage the role admins in the ACLManager
setRoleAdmin
addPoolAdmin
removePoolAdmin
addEmergencyAdmin
removeEmergencyAdmin
addRiskAdmin
removeRiskAdmin
addFlashBorrower
removeFlashBorrower
addBridge
removeBridge
addAssetListingAdmin
removeAssetListingAdmin
EMERGENCY_ADMIN
Can pause/unpause the pool or individual reserve
setPoolPause
POOL_ADMIN
Can
update token implementations
drop reserves
pause/unpause reserves
activate/deactivate reserves
update premiums
do all the things available to RISK_ADMIN & ASSET_LISTING_ADMIN
all methods available to RISK_ADMIN
all methods available to ASSET_LISTING_ADMIN
dropReserve
updateAToken
updateStableDebtToken
updateVariableDebtToken
setReserveActive
updateBridgeProtocolFee
updateFlashloanPremiumTotal
updateFlashloanPremiumToProtocol
Returns true if the address has POOL_ADMIN role.
Returns true if the address has EMERGENCY_ADMIN role.
Returns true if the address has RISK_ADMIN role.
Returns true if the address has FLASH_BORROWER role.
Returns true if the address has BRIDGE role.
Returns true if the address has ASSET_LISTING_ADMIN role.
setRoleAdmin(bytes32 role, bytes32 adminRole)
Setup admin to manage Roles.
This method can only be called by address with DEFAULT_ADMIN_ROLE .
role
bytes32
keccak256 hash of one of the following:
POOL_ADMIN
EMERGENCY_ADMIN
RISK_ADMIN
FLASH_BORROWER
BRIDGE
ASSET_LISTING_ADMIN
adminRole
bytes32
adminRole responsible for role. 0x00 is reserved for DEFAULT_ADMIN_ROLE
Add address to the list of members in POOL_ADMIN role. Holders of this role can update token implementations, drop, (un) pause and (de)activate reserves, update premiums and do everything the ASSET_LISTING_ADMIN and RISK_ADMIN can do.
Can be called only byRole Admin, specified byAave Governance, responsible for managing POOL_ADMIN role.
admin
address
address which will be granted POOL_ADMIN role.
Remove given address from the list of members in POOL_ADMIN role.
Can be called only byRole Admin, specified byAave Governance, responsible for managing POOL_ADMIN role.
admin
address
address for which POOL_ADMIN role permissions must be revoked.
Add address to the list of members in EMERGENCY_ADMIN role. Holders of this role can pause and unpause the pool or an individual reserve.
Can be called only byRole Admin, specified byAave Governance, responsible for managing EMERGENCY_ADMIN role.
admin
address
address which will be granted EMERGENCY_ADMIN role.
Remove given address from the list of members in EMERGENCY_ADMIN role.
Can be called only byRole Admin, specified byAave Governance, responsible for managing EMERGENCY_ADMIN role.
admin
address
address for which EMERGENCY_ADMIN role permissions must be revoked.
Add address to the list of members in RISK_ADMIN role. Holders of this role can update grace period of Oracle Sentinels, reserve params, unbacked mint cap,liquidation fee and eMode categories.
admin
address
address which will be granted RISK_ADMIN role.
Remove given address from the list of members in RISK_ADMIN role.
admin
address
address for which RISK_ADMIN role permissions must be revoked.
Add address to the list of members in FLASH_BORROWER role. Holders of this role do not pay premium for flash loan (Does not apply to flashLonaSimple).
Remove given address from the list of members in FLASH_BORROWER role.
admin
address
address for which FLASH_BORROWER role permissions must be revoked.
Add contract address to the list ofbridges. Holders of this role can leverage the Portal feature to seamlessly move supplied assets across Aave V3 markets on different networks.
Can be called only byRole Admin, specified byAave Governance, responsible for managing BRIDGE role.
bridge
address
address which will be granted BRIDGE role.
Remove contract address from the list of bridges.
Can be called only byRole Admin, specified byAave Governance, responsible for managing BRIDGE role.
bridge
address
address for which BRIDGE role permissions must be revoked.
Add address to the list of member in ASSET_LISTING_ADMIN role. Holder of this role can update oracles & add new asset to the Aave market. ``
admin
address
address which will be granted ASSET_LISTING_ADMIN role.
Remove address from the list of members in ASSET_LISTING_ADMIN role.
admin
address
address for which ASSET_LISTING_ADMIN role permissions must be revoked.
A register of the active
Disconnected from the target VM, address: 'localhost:60489', transport: 'socket' PoolAddressesProvider contracts, covering all markets. This contract is immutable and the address will never change. For example, the Pool address for the main market is different from the Pool address for the AMM market.
The source code can be found onGithub.
Returns a list of activePoolAddressesProvider contracts for the registered Aave protocol markets.
address[]
List of active PoolAddressesProvider
Returns Id of PoolAddressesProvider .
addressesProvider
address
Address of the PoolAddressesProvider
uint256
Id of the associated PoolAddressesProvider. 0 indicates not a valid PoolAddressesProvider address
Themis V2 contract is divided into two main parts.
The first part is the M0 Pool contract, which mainly provides deposit, debit, clearing, and flash credit for mainstream tokens, and issues corresponding t/s/v tokens for deposit and debit. The related contract mainly contains modules for the configuration of the pool each pool price calculation and interest rate, clearing, and other configuration functions. The auxiliary contract mainly contains rewards, ui data provider, incentive data provider, wallet balance provider and WETH gateway.
The second part is the M1 Pool contract, which mainly provides Uniswap V2/V3, and other third-party LP lending functions, and issues corresponding s/v tokens for the corresponding lending behavior. The relevant contract mainly contains modules for the configuration of the pools each pool price calculation and interest rate, clearing, and other configuration functions.
The available M1Pool borrow cap is from the M0 Pool, and the corresponding assets and s/v token borrowed by the user are minted from the M0 Pool.
Core protocol contracts fall in following 4 categories:
Configuration
Pool logic
Tokenization
Misc
Themis Protocol V2 implements an access control list to segregate powers and/or benefits that can be allocated to different entities on the protocol. The roles and holders are managed in the ACLManager.sol, which keeps track of the individual roles and its holders.
The main addresses register of the protocol, containing address of *core protocol contracts *and ACL admin. It acts as factory of proxies and admin of those. The owner of this contract has the right to set/update implementation of the upgradable contracts. The latest contract addresses should be retrieved from this contract by making the appropriate calls.
Contains a list of active
PoolAddressProvider addresses, for different markets. It is used for indexing all Themis protocol’s markets.
Oracle Sentinel validates if operations are allowed depending on the PriceOracle health. Once the PriceOracle gets up after an outage/downtime, users can make their positions healthy during a grace period.
Implements the calculation of the interest rates depending on the reserve state. This contract holds the information needed to calculate and update the yield relating to specific liquidity pools. Each contract stores the optimised base curves using the corresponding parameters of each asset. This means that there is a mathematical function which determines the yield of each liquidity pool, with the yield changing based on the amount of borrowed funds and the total liquidity (i.e. utilisation) of the pool.
The main entry point into the Themis Protocol. Most user interactions with the Themis Protocol occur via the Pool contract. Pool is owned by the PoolAddressesProvider of the specific market. All admin functions are callable by the PoolConfigurator contract, which is defined in PoolAddressesProvider.
Provider configuration methods for the Pool contract. The write methods of this contract can only be called by addresses with corresponding permission-ed system roles that are managed by ACLManager.
Yield-generating tokens that are minted and burnt upon supply and withdraw of assets to Themis Pool
The special type of aToken that are minted and burnt upon supply and withdraw of assets that has voting power associated (which can be delegated) with them.
The non-transferable interest accruing, stable rate tokenised borrows.
The non-transferable interest accruing, variable rate tokenised borrows.
Contract to get asset prices, manage price sources and update the fallback oracle.
Peripheral contract to collect and pre-process information from the Pool.
This contract is responsible for configuring the different rewards and the claim process.
These are isolated contracts that manages the procedure of the rewards transfer at claim. This allows the RewardsController to support any custom rewards like Staked Themis, common ERC20 or even NFT.
Helper contract to fetch Incentives Data. It is used by Themis UI for reward balance info.
Helper contract, used by Themis UI, to fetch Pool Data such reserves list, all reserves data like liquidity, token addresses, rate strategy etc.
Only ERC20 tokens can be supplied & borrowed from the Themis Protocol V2 pools. To facilitate using token native to the chain (such ETH on Ethereum or Matic on polygon) a helper contract is used to support single tx supply, borrow, repay and withdraw.
Used for getting multiple tokens balance for one user address. This contract is used by Themis backend to reduce the number of blockchain calls for fetching user balance.
Core protocol contracts fall in following 4 categories:
Configuration
M1Pool logic
Tokenization
Misc
M1 Configuration is similar to M0
The main entry point into the Themis Protocol. Most user interactions with the Themis Protocol occur via the Pool contract. Pool is owned by the PoolAddressesProvider of the specific market. All admin functions are callable by the PoolConfigurator contract, which is defined in PoolAddressesProvider.
Provider configuration methods for the M1 Pool contract. The write methods of this contract can only be called by addresses with corresponding permission-ed system roles that are managed by ACLManager.
M1 tokenization configuration is Similar to M0
Helper contract, used by Themis UI, to fetch Pool Data such reserves list, all reserves data like liquidity, token addresses, rate strategy etc.
M1CollateralValueCalculator
M1 asset-specific calculation price contract, mainly used for Uniswap v2/v3 LP, Balancer BPT, Arrakis Vault, Curve LP etc. value calculation
M1Pool configuration contract, risk control and administrator operations.
Set whether this type of collateral pool is available for re-borrowing in M1Pool
collateralAddress
address
the contract address of collateral
enabled
bool
true:allow borrowing, false:do not allow borrowing
Set whether the collateral pool of this type can be active again in M1Pool
collateralAddress
address
the contract address of collateral
enabled
bool
true:activated, false:inactive
Set whether the collateral pool of this type can be frozen in M1Pool or not
collateralAddress
address
the contract address of collateral
enabled
bool
true:frozen, false:unfrozen
Set the maximum amount of USD value that can be borrowed for this type of asset.
collateralAddress
address
the contract address of collateral
quantity
uint256
Maximum number of USD values available for borrowing
Set the parameters of LiquidationThreshold
for this type of collateral pool.
collateralAddress
address
contract address of the collateral asset
liquidationThreshold
uint256
Actual collateral value to the collateral value.
liquidationBonus
uint256
The bonus for the liquidators
collateralAddress
address
contract address of collateral asset
factor
uint256
the factor of loan to value
Add a lendable asset to a particular collateral pool (the asset must be in Pool)
collateralAddress
address
contract address of collateral asset
asset
address
the available borrowing asset type for the collatral
To set the available borrowing asset for a collateral asset
collateralAddress
address
contract address of the collateral
asset
address
available asset to borrow
enabled
bool
true: enable borrowing, false: disable borrowing
To set collateral asset paused
collateralAddress
address
contract address of the collateral
asset
address
contract address of the collateral
enabled
bool
true: paused,false: on going
When an asset is frozen, all function will be frozen
collateralAddress
address
contract address of collateral
asset
address
available borrwoing assset
enabled
bool
true: frozen,false: unfrozen
Set the perameters for E-mode
categoryId
uint8
category id
ltv
uint16
ltv
liquidationThreshold
uint16
Liquidationthreshold
liquidationBonus
uint16
bonus for liquidators
oracle
oracle
smart contract address of Oracle
label
string
discription
set E-mode for a specifical collateral asset.
collateralAddress
address
Contract address of collateral
newCategoryId
uint8
Catagory ID of E-mode
Check the basic configuration of the collateral pool
collateralAddress
address
Contract address of collateral
name
string
Name of collateral pool
m1CollateralTypeModel
M1CollateralTypeModel
Collateral pool types 0: unconfigured type, 1: UNISWAP V3 pool, 2: UNISWAP V2 pool, 3: single LP (ERC20) pool
isBorrowing
bool
Borrowable or not true:can be borrowed, false:cannot be borrowed
isActive
bool
Activated or not true:activated, false: not activated
isFrozen
bool
Whether to freeze or not true:frozen, false:not frozen
maxBorrowLimitInBaseCurrency
uint256
The total maximum number of USD that can be borrowed in this collateralized lending pool
ltv
uint256
loan to value
liquidationThreshold
uint256
liquidation threshold
liquidationBonus
uint256
bonus to value for liquidator
factor
uint256
factor
categoryId
uint8
catagory ID for E-mode
Check the configuration of an asset in this collateral pool
collateralAddress
address
抵押物合约地址
collateralAddress
asset
可借资产配置
isBorrowing
bool
Borrowable or not true:can be borrowed, false:cannot be borrowed
isActive
bool
Activated or not true:activated, false:not activated
isFrozen
bool
Whether to freeze or not true:frozen, false:not frozen
Get a collection of lending asset addresses backed by this collateralized lending pool.
collateralAddress
address
contract address of collateral
address[]
Available borrowing assets address
Query contract addresses of all collateral pools supported by M1Pool
address[]
supported lending pool address
Get the configuration information of E-mode according to E-mode id
This contract validates if the operations are allowed depending on the PriceOracle health.
The PriceOracle
is considered healthy once its completely up and the grace period has passed.
function isBorrowAllowed()
bool
Returns true if PriceOracle is up and grace period has passed
function isLiquidationAllowed()
bool
Returns true if PriceOracle is up and grace period has passed
function getSequencerOracle()
address
Address of the SequencerOracle.
function getGracePeriod()
uint256
The duration of the grace period in seconds.
function setSequencerOracle(address newSequencerOracle)
Can be called only by PoolAdmin.
newSequencerOracle
address
address of the new SequecerOracle to be set.
function setGracePeriod(uint256 newGracePeriod)
Can be called only by PoolAdmin or RiskAdmin.
newGracePeriod
uint256
duration of new grace period in seconds.
All rewards type enabled in Themis V2 are managed by RewardsDistributor.sol . This is the contract used to check rewards data, user’s rewards balance and for claiming the rewards.
rewards
mapping(address ⇒ RewardData)
availableRewards
address[]
decimals
uint8
emissionPerSecond
uint88
index
uint104
lastUpdateTimestamp
uint32
distributionEnd
uint32
usersIndex
mapping(address => uint256)
getRewardsData (asset, reward)
Get the data of the reward emitted for the asset.
Call Params
asset
address
address of the t/s/v Tokens for which incentive information is requested
reward
address
address of the reward token
Return Value
uint104
index of the reward token
uint88
total reward tokens awarded per second for the given asset pool
uint32
unix timestamp of last time the emissions were updated
uint32
unix timestamp of when the emissions will end
getRewardsByAsset (asset)
Get the list of rewards activated for the asset
asset
address
address of the t/s/vTokens for which incentive rewards list is requested
address[]
list of reward token addresses activated for the given asset
claimRewards (assets, amount, to, reward)
Claims single reward type specified by reward for the list of assets. Rewards are received by to address.
assets
address[]
address list of assets for which rewards are being claimed. Pass t/s/vToken addresses
amount
uint256
amount to claim, expressed in wei. Pass MAX_UINT to claim entire unclaimed reward balance
to
address
address which will receive the reward tokens
reward
address
address of the reward token being claimed. eg. stkAthemis
claimRewardsOnBehalfOf (assets, amount, user, to, reward)
Claims single reward type specified by reward for the given list of assets on behalf of the user . Rewards are received by to address.
The msg.sender must be an authorised claimer set using
setClaimer()
method, via Governance Vote.
assets
address[]
address list of assets for which rewards are being claimed. Pass t/s/vToken addresses
amount
uint256
amount to claim, expressed in wei. Pass MAX_UINT to claim entire unclaimed reward balance
user
address
address of user who’s rewards are being claimed
to
address
address which will receive the reward tokens
reward
address
address of the reward token being claimed. eg. stkAthemis
claimRewardsToSelf (assets, amount, reward)
Claims single reward type accrued by the msg.sender
specified by reward for the given list of assets. Rewards are received by msg.sender
.
assets
address[]
address list of assets for which rewards are being claimed. Pass t/s/vToken addresses
amount
uint256
amount to claim, expressed in wei. Pass MAX_UINT to claim entire unclaimed reward balance
reward
address
address of the reward token being claimed. eg. stkAthemis
claimAllRewards (assets, to)
Claims all rewards for the list of assets. Rewards are received by to address.
assets
address[]
address list of assets for which rewards are being claimed. Pass t/s/vToken addresses
to
address
address which will receive the reward tokens
claimAllRewardsOnBehalfOf (assets, user, to)
Claims all rewards for the given list of assets on behalf of the user . Rewards are received by to address.
The msg.sender must be an authorised claimer set using setClaimer()
method, via Governance Vote.
assets
address[]
address list of assets for which rewards are being claimed. Pass t/s/vToken addresses
user
address
address of user who’s rewards are being claimed
reward
address
address of the reward token being claimed. eg. stkTMS
claimAllRewardsToSelf (assets)
Claims all rewards accrued by msg.sender for the given list of assets. Rewards are received by msg.sender .
assets
address[]
address list of assets for which rewards are being claimed. Pass t/s/vToken addresses
Implements a logic of getting multiple tokens balance for one user address. For getting ETH (native chain token) balance use MOCK_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
.
function balanceOf(address user, address token)
Returns the balance of the token for user (ETH included with MOCK_ETH_ADDRESS).
function batchBalanceOf(address[] calldata users, address[] calldata tokens)
Returns balances for a list of users and tokens (ETH included with MOCK_ETH_ADDRESS).
function getUserWalletBalances(address provider, address user)
Provides balances of user wallet for all reserves available on the pool
The special type of tToken that are minted and burned upon supply and withdrawl of assets that has voting power associated (which can be delegated) with them. These tTokens are enabled to delegate the voting power of the underlying asset to a different address.
DelegationAwaretToken enables/implements all the methods available for tTokens with additional delegateUnderlyingTo
method.
Refer tToken
docs for full list of contract API
function delegateUnderlyingTo(address delegatee)
Delegates voting power of the underlying asset to a delegatee address.
This method can only be called by POOL_ADMIN.
Debt tokens are interest-accruing tokens that are minted and burned on borrow and repay , representing the debt owed by the token holder. There are 2 types of debt tokens:
Stable Debt Tokens: represent a debt to the protocol with stable interest rate.
Variable Debt Tokens: represent a debt to the protocol with variable interest rate.so
Debt tokens are not transferable.
The s/vToken value is pegged 1:1 to the value of underlying borrowed asset and represents the current total amount owed to the protocol i.e. principal debt + interest accrued.
Although debt tokens are modelled on the ERC20/EIP20 standard, they are non-transferrable. Therefore they do not implement any of the standard ERC20/EIP20 functions relating to transfer()
and allowance()
.
Following are the standard EIP20 methods that are implemented for the debt tokens:
function balanceOf(address account)
Returns the most up to date accumulated debt (principal+interest) of the user.
function totalSupply()
Returns the most up to date total debt accrued by all protocol users for that specific type*(stable or variable rate)*of debt token.
function decimals()
Returns decimals of the token contract.
function symbol()
Returns the symbol of the token contract.
function name()
Returns the name of the token contract.
function DOMAIN_SEPARATOR()
Get the domain separator for the token at current chain.
function nonces(address owner)
Returns the nonce value for address specified as parameter. This is the nonce used when calling permit()
Below are the view methods available for both type, stable and variable, of debt tokens.
function POOL()
Returns the address of the associated Pool for the debt token.
function borrowAllowance(address fromUser, address toUser)
function UNDERLYING_ASSET_ADDRESS()
Returns the underlying asset of the debt token.
function getIncentivesController()
Returns the address of the Incentives Controller contract
Below are the write methods available for both type, stable and variable, of debt tokens.
function approveDelegation(address delegatee, uint256 amount)
Sets the amount
of allowance for delegatee to borrow of a particular debt token.
function delegationWithSig(address delegator, address delegatee, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
Sets the value
of allowance for delegatee to borrow of a particular debt token via permit function.
function setIncentivesController(IIncentivesController controller)
Sets a new Incentives Controller.
Only Pool Admin can call this methods. To update Incentives Controller on main Themis market, Governance Proposal must be submitted.
function getAverageStableRate()
Returns the average stable rate across all the stable rate debt in the protocol as uint256
.
function getUserLastUpdated(address user,uint256 borrowType,uint256 orderId)
Returns the timestamp of the last action taken by user as uint40 .
function getUserStableRate(address user,uint256 borrowType,uint256 orderId)
Returns the stable rate of user as uint256 .
function getSupplyData()
Returns the principal, the total supply, the average stable rate and the timestamp for the last update.
function getTotalSupplyAndAvgRate()
Returns the total supply and average stable rate of the token.
function getTotalSupplyLastUpdated()
Returns the timestamp of the last update of the total supply in uint40 .
function principalBalanceOf(address user, uint256 borrowType,uint256 orderId)
Returns the principal debt balance of the user since the last burn/mint action.
function scaledBalanceOf(address user)
Returns the scaled debt balance of user
. The scaled balance is the sum of all the updated stored balance divided by the reserve's liquidity index at the moment of the update.
function getScaledUserBalanceAndSupply(address user)
Returns the scaled balance of the user and the scaled total supply.
function scaledTotalSupply()
Returns the scaled total supply of the debt token. Represents sum(debt/index)
function getPreviousIndex(address user)
Returns last index interest that was accrued to the user's balance (expressed in ray).
The WETH Gateway contract is a helper to easily wrap and unwrap ETH (or native currency of chain eg. MATIC, AVAX etc) as necessary when interacting with the protocol.
function depositETH(address pool, address onBehalfOf, uint16 referralCode)
Supplies the msg.value
amount of ETH (or native chain token) into the Themis pool, minting the same amount of corresponding tWETH and transferring them to the onBehalfOf
address.
Ensure that the depositETH()
transaction also includes the amount of ETH you are supplying in the msg.value
.
function withdrawETH(address pool, uint256 amount, address to)
Withdraws amount
of the WETH (or wrapped native chain token), unwraps it and transfers ETH (or native chain token) to the to address.
💡 Ensure you set the relevant aToken
allowance, before calling this function, so the WETHGateway
contract can transfer the associated aWETH.
function repayETH(address pool, uint256 amount, uint256 rateMode, address onBehalfOf)
Repays onBehalfOf
's debt amount of ETH () which has a rateMode
.
Ensure that the repayETH() transaction also includes the amount of ETH you are repaying in the msg.value .
function borrowETH(address pool, uint256 amount, uint256 interestRateMode, uint16 referralCode)
Borrows amount
of WETH with interestRateMode , sending the amount of unwrapped WETH to msg.sender .
function withdrawETHWithPermit(address pool, uint256 amount, address to, uint256 deadline, uint8 permitV, bytes32 permitR, bytes32 permitS)
Withdraws amount
of the WETH (or wrapped native chain token) without a separate approval tx. The ETH (or native chain token) is sent to the to address.
function emergencyTokenTransfer(address Token, address to, uint256 amount)
Method for ERC20 recovery in case of stuck tokens due direct transfers to the contract address.
Can be called only by the owner of the contract i.e. Themis Governance
function emergencyEtherTransfer(address to, uint256 amount)
Method for ETH (or native chain token) recovery in case of stuck ETH due selfdestruct or transfer ether to pre-computated contract address before deployment.
Can be called only by the owner of the contract i.e. Governance.
function getWETHAddress()
Returns the WETH address used by the WETHGateway.
Abstract contract template to build Distributors contracts for ERC20 rewards to protocol participants
function setClaimer(address user, address claimer) external
Whitelists an address to claim the rewards on behalf of another address
function setTransferStrategy(address reward, ITransferStrategyBase transferStrategy) external
Sets a TransferStrategy logic contract that determines the logic of the rewards transfer
function setRewardOracle(address reward, IEACAggregatorProxy rewardOracle) external
Sets an Oracle contract to enforce rewards with a source of value.
At the moment of reward configuration, the Incentives Controller performs a check to see if the reward asset oracle is compatible with IEACAggregator proxy. This check is enforced for integrators to be able to show incentives at the current UI without the need to setup an external price registry
function configureAssets(RewardsDataTypes.RewardsConfigInput[] memory config) external
Configure assets to incentivize with an emission of rewards per second until the end of distribution.
function handleAction( address user, uint256 userBalance, uint256 totalSupply ) external;
Called by the corresponding asset on any update that affects the rewards distribution.Default borrow type m0.
function handleAction( address user, uint256 m0UserBalance, uint256 m1UserBalance, uint256 m0TotalSupply, uint256 m1totalSupply ) external
Called by the corresponding asset on any update that affects the rewards distribution
function claimRewards( address[] calldata assets, uint256 amount, address to, address reward ) external returns (uint256,uint256);
Claims reward for a user to the desired address, on all the assets of the pool, accumulating the pending rewards
function claimRewardsOnBehalf( address[] calldata assets, uint256 amount, address user, address to, address reward ) external returns (uint256,uint256);
Claims reward for a user on behalf, on all the assets of the pool, accumulating the pending rewards. The caller must be whitelisted via "allowClaimOnBehalf" function by the RewardsAdmin role manager
function claimRewardsToSelf( address[] calldata assets, uint256 amount, address reward, uint256 borrowType ) external returns (uint256,uint256);
Claims reward for msg.sender, on all the assets of the pool, accumulating the pending rewards
@return The m0 amount of rewards claimed
@return The m1 amount of rewards claimed
function claimAllRewards(address[] calldata assets, address to) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts);
Claims all rewards for a user to the desired address, on all the assets of the pool, accumulating the pending rewards
function claimAllRewardsOnBehalf( address[] calldata assets, address user, address to, uint256 borrowType ) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts);
function claimAllRewardsToSelf(address[] calldata assets,uint256 borrowType) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts);
Claims all reward for msg.sender, on all the assets of the pool, accumulating the pending rewards
function getRewardOracle(address reward) external view returns (address)
Get the price aggregator oracle address
function getClaimer(address user) external view returns (address)
Returns the whitelisted claimer for a certain address (0x0 if not set)
function getTransferStrategy(address reward) external view returns (address)
Returns the Transfer Strategy implementation contract address being used for a reward address
function getTransferStrategy(address reward) external view returns (address)
Returns the Transfer Strategy implementation contract address being used for a reward address
The M1Pool.sol
contract is the main user facing contract of the protocol. It exposes the liquidity management methods that can be invoked using either Solidity or Web3 libraries.
User can borrow the amount
of asset
by collateral the collateralAddress
asset to M1Pool
When borrowM1
, the M1Pool contract must have** allowance()
to spend funds on behalf of msg.sender ** for at-least** amount ** for the** asset **being supplied. This can be done via the standard ERC20/ERC721 approve()
method on the underlying token contract.
Referral program is currently inactive, you can pass 0 as referralCode
. This program may be activated in the future through an Aave governance proposal.
Liquidation operation based on the record ID generated by the collateral, anyone can call this interface when the collateral record triggers the liquidation.
Check if the collateral record has been liquidated against the record ID
Get information about how many collateral records the user has based on the user's address
Get the collateral details based on the collateral record ID.
Get the total number of debts for which the user borrowed a certain asset
Allocation of original rewards from third-party protocols in the Pool of collaterals
function userHandleAction( address collateralAddress, DataTypes.M1CollateralOptType collateralOptType, address rewardOwnerUser, uint256 amountLp) external
OnlytToken
can call the method, Triggered when users borrow, repay, or liquidate
function userClaimCollateralRewardsBySingleTToken(address collateralAddress, CollateralPoolRewardTypes.UserClaimableTTokenParams memory tTokenParams) external
Users receive rewards for the pool in which that collateral asset is located, based on the collateral asset.
CollateralPoolRewardTypes.UserClaimableTTokenParams
User-claimable reward parameter structure (tToken
dimension)
function userClaimCollateralRewardsByCollateral(CollateralPoolRewardTypes.UserClaimableCollateralParams[] memory collateralParams) externa
The user receives, based on the collateral asset, the rewards of the pool in which that collateral asset is located.
CollateralPoolRewardTypes.UserClaimableCollateralParams
User query for claimable rewards parameter structure (collateral
dimension)
function userClaimAllCollateralRewards() external
Receive rewards for the pool in which all collateral assets are located.
Too much collateral will be reported as an error.
function getRewards(address collateralAddress) external view returns (address[] memory)
Get the list of reward token
owned by this pool of collateralized assets
function getUserClaimableRewardsBySingleTToken(address user, address collateralAddress, CollateralPoolRewardTypes.UserClaimableTTokenParams[] memory tTokenParams) external view returns (CollateralPoolRewardTypes.UserClaimableTTokenResult[] memory)
Acquire based on single or multiple tToken
dimensions to obtain rewards for users who can receive a pool of re-collateralized assets.
CollateralPoolRewardTypes.UserClaimableTTokenResult
Return Values
function getUserClaimableRewardsByCollateral(address user, CollateralPoolRewardTypes.UserClaimableCollateralParams[] memory collateralParams) external view returns (CollateralPoolRewardTypes.UserClaimableCollateralResult[] memory)
Based on single or multiple collateral
dimension acquisition, get the rewards that users can receive to change the pool of collateral assets.
CollateralPoolRewardTypes.UserClaimableCollateralResult
Return Values
function getUserAllClaimableRewards(address user) external view returns (CollateralPoolRewardTypes.UserClaimableCollateralResult[] memory)
Acquiring users can receive rewards for changing the collateral asset pool.
pool
address
address of the targeted pool
onBehalfOf
address
address who will receive the aWETH. Use msg.sender when the tTokens should be sent to the caller.
referralCode
uint16
unique code for 3rd party referral program integration. 0 for no referra
pool
address
address of the targeted pool
amount
uint256
amount to be withdrawn, expressed in wei units. Use type(uint).max to withdraw the entire balance.
to
address
address that will receive the unwrapped ETH
lendingPool
address
address of the targeted underlying lending pool
amount
uint256
amount to be borrowed, expressed in wei units. Use uint(-1) to repay the entire debt, ONLY when the repayment is not executed on behalf of a 3rd party. In case of repayments on behalf of another user, it's recommended to send an _amount slightly higher than the current borrowed amount.
rateMode
uint256
the type of borrow debt. Stable: 1, Variable: 2
onBehalfOf
address
address of user who will incur the debt. Use msg.sender when not calling on behalf of a different user.
pool
address
address of the targeted pool
amount
uint256
amount to be borrowed, expressed in wei units
interestRateMode
uint256
the type of borrow debt. Stable: 1, Variable: 2
referralCode
uint16
unique code for 3rd party referral program integration. 0 for no referral code.
pool
address
address of the targeted pool
amount
uint256
amount of tWETH (or aToken corresponding to native token of chain) that will be burnt to withdraw ETH (or native chain token)
to
address
address that will receive the ETH (or native chain token)
deadline
uint256
unix timestamp till which the signature is valid
permitV
uint8
Signature parameter v
permitR
bytes32
Signature parameter r
permitS
bytes32
Signature parameter s
user
address
The address of the user
claimer
address
The address of the claimer
reward
address
The address of the reward token
transferStrategy
ITransferStrategyBase
The address of the TransferStrategy logic contract
reward
address
The address of the reward to set the price aggregator
rewardOracle
IEACAggregatorProxy
The address of price aggregator that follows IEACAggregatorProxy interface
config
RewardsDataTypes.RewardsConfigInput[]
config The assets configuration input, the list of structs contains the following fields
emissionPerSecond
uint88
The emission per second following rewards unit decimals.
distributionStart
uint256
The start of the distribution of the incentives for an asset
distributionEnd
uint32
The end of the distribution of the incentives for an asset
asset
address
The asset address to incentivize
reward
address
The reward token address
transferStrategy
ITransferStrategyBase
The TransferStrategy address with the install hook and claim logic.
rewardOracle
IEACAggregatorProxy
The Price Oracle of a reward to visualize the incentives at the UI Frontend. Must follow Chainlink Aggregator IEACAggregatorProxy interface to be compatible.
m0EmissionTotal
uint256
M0 Total reward quantity
m1ExtraEmissionTotal
uint256
M1 Total number of additional rewards
m1ExtraEmissionRatio
uint256
Compared with M0 total reward coefficient
rewardPeriod
uint256
Number of incentive periods
user
address
The address of the user
userBalance
uint256
The user balance of the asset
totalSupply
uint256
The total supply of the asset
user
address
The address of the user
m0UserBalance
uint256
The user balance of the m0 asset
m1UserBalance
uint256
The user balance of the m1 asset
m0TotalSupply
uint256
The total supply of the m0 asset
m1totalSupply
uint256
The total supply of the m1 asset
assets
address[]
assets List of assets to check eligible distributions before claiming rewards
amount
uint256
The amount of rewards to claim
to
address
The address that will be receiving the rewards
reward
address
The address of the reward token
uint256
The m0 amount of rewards claimed
uint256
The m1 amount of rewards claimed
assets
address[]
assets List of assets to check eligible distributions before claiming rewards
amount
uint256
The amount of rewards to claim
user
address
The address to check and claim rewards
to
address
The address that will be receiving the rewards
reward
address
The address of the reward token
uint256
The m0 amount of rewards claimed
uint256
The m1 amount of rewards claimed
assets
address[]
assets List of assets to check eligible distributions before claiming rewards
amount
uint256
The amount of rewards to claim
reward
address
The address of the reward token
assets
address[]
The list of assets to check eligible distributions before claiming rewards
to
address
The address that will be receiving the rewards
rewardsList
address[]
List of addresses of the reward tokens
claimedAmounts
uint256[]
List that contains the claimed amount per reward, following same order as rewardList
assets
address[]
The list of assets to check eligible distributions before claiming rewards
user
address
The address to check and claim rewards
to
address
The address that will be receiving the rewards
borrowType
uint256
The borrow type
rewardsList
address[]
List of addresses of the reward tokens
claimedAmounts
uint256[]
List that contains the claimed amount per reward, following same order as rewardsList
assets
address[]
The list of assets to check eligible distributions before claiming rewards
rewardsList
address[]
List of addresses of the reward tokens
claimedAmounts
uint256[]
List that contains the claimed amount per reward, following same order as rewardsList
reward
address
The address of the reward
address
The price oracle of the reward
user
address
user The address of the user
address
The claimer address
reward
address
reward The address of the reward
address
The address of the TransferStrategy contract
assets
address[]
The list of assets to check eligible distributions before claiming rewards
user
address
User address
asset
The address of the TransferStrategy contract
userM0Balance
The user m0 balance of the asset
userM1Balance
The user m1 balance of the asset
m0TotalSupply
The m0 total supply of the asset to incentivize
m1TotalSupply
The m1 total supply of the asset to incentivize
totalSupply
The total supply of the asset to incentivize
userRecordId
uint256
Record ID generated after collateralizing assets
collateralAmount
uint256
Increase in the amount of collateral assets
userRecordId
uint256
Record ID generated after collateralizing assets
collateralAmount
uint256
Reducing the amount of collateral assets
userRecordId
uint256
Record ID generated after collateralizing assets
amount
uint256
The amount of new borrow needs
onBehalfOf
address
address of user who will incur the asset.
collateralAddress
address
contract address of the collateral asset
userRecordId
uint256
Record ID generated after collateralizing assets
asset
address
The contract address of the borrowing asset
amount
uint256
the amount of reapy
onBehalfOf
address
the receiver of the collateral, when fully repaid
recordId
uint256
Record ID generated after collateralizing assets
currentCollateralValueInBaseCurrency
uint256
Current value of the collateral
collateralDebt
uint256
current debt of the collateral
collateralDebtInBaseCurrency
uint256
current debt value of the collateral
liquidationThreshold
uint256
Liquidation threshold
collateralCurrentRatio
uint256
Current Loan risk, when its bigger than Liquidation threshold, the liquidation method can be call.
user
address
user address
uint256[]
current collateral record of user
tToken
address
tToken
Contract address
rewards
address[]
This collateral pool rewards array
collateralAddress
address
Collateral's pool address
tTokenParams
CollateralPoolRewardTypes.UserClaimableTTokenParams
User-claimable reward parameter structure (tToken dimension)
collateralAddress
address
Collateral's pool address
collateralParams
CollateralPoolRewardTypes.UserClaimableCollateralParams[]
User query for claimable rewards parameter structure (collateral
dimension)
collateralAddress
address
Collateral's Pool ddress
address[]
List of contracts for pool rewards
user
address
Wallet address
collateralAddress
address
Collateral pool address
tTokenParams
CollateralPoolRewardTypes.UserClaimableTTokenParams
User-claimable reward parameter structure (tToken
dimension)
tToken
address
tToken
address
rewards
address[]
This collateral pool rewards array
quantity
uint256[]
This collateral pool award quantity array
CollateralPoolRewardTypes.UserClaimableTTokenResult[]
Reward details
user
address
wallet address
collateralAddress
address
Collateral's pool address
collateralParams
CollateralPoolRewardTypes.UserClaimableCollateralParams
User-claimable reward parameter structure (collateral
dimension)
collateral
address
Collateral asset contract address
tTokenResults
CollateralPoolRewardTypes.UserClaimableCollateralResult[]
Reward Details Array
CollateralPoolRewardTypes.UserClaimableCollateralResult[]
Reward details
user
address
User Address
CollateralPoolRewardTypes.UserClaimableCollateralResult[]
reward details
uint256
The principal stable debt issued
uint256
The total stable debt for the reserve across all users. Based on avg stable rate.
uint256
The average stable debt rate across all users.
uint40
The timestamp of the last update on total supply of stable debt token.
uint256
total debt token supply. (includes principal + cumulated interest)
uint256
average stable rate
collateralAddress
address
Contract address of collateral assets
collateralAmount
uint256
The number of collateral, send in the tokenId when it is uniswapV3, and send in the number of collateral to be deposit for the others
asset
address
address of the underlying asset
amount
uint256
amount to be borrowed, expressed in wei units
interestRateMode
uint256
the type of borrow debt. Stable: 1, Variable: 2
referralCode
uint16
referral code for our referral program. Use 0 for no referral code.
onBehalfOf
address
address of user who will incur the asset. Use msg.sender when not calling on behalf of a different user.
Contract to get asset prices, manage price sources and update the fallback oracle. Themis Protocol V2 uses Chainlink Aggregators as the source of all asset prices.
function getAssetPrice(address asset)
Returns the price of the supported asset in BASE_CURRENCY of the Themis Market in wei.
uint256
Price in BASE_CURRENCY of the Themis market in wei.
function getAssetsPrices(address[] calldata assets)
Returns the prices of the supported assets in BASE_CURRENCY of the Themis Market. All prices are in wei.
assets
address[]
The addresses of the assets for which price is being queried.
uint256[]
Prices in BASE_CURRENCY of the Themis market in wei.
function getSourceOfAsset(address asset)
Returns the address of the price source for asset
.
function getFallbackOracle()
Returns the address of the fallback oracle.
function setAssetSources(address[] calldata assets, address[] calldata sources)
Sets the price source for given list of assets.
This method can be called only by POOL_ADMIN or ASSET_LISTING_ADMIN . Check ACLManager for details on system roles.
assets
address[]
The addresses of the assets for which source is being set.
sources
address[]
The address of the source of each asset. Length of assets and sources array should be same.
function setFallbackOracle(address fallbackOracle)
Sets/updates the fallback oracle.
This method can be called only by POOL_ADMIN or ASSET_LISTING_ADMIN . CheckACLManagerfor details on system roles.
fallbackOracle
address
The address of the fallback oracle.
tTokens are tokens minted and burnt upon supply and withdraw of assets to an Themis market, which denote the amount of crypto assets supplied and the yield earned on those assets. The tTokens’ value is pegged to the value of the corresponding supplied asset at a 1:1 ratio and can be safely stored, transferred or traded. All yield collected by the tTokens' reserves are distributed to tToken holders directly by continuously increasing their wallet balance.
All standard EIP20 methods are implemented for tTokens, such as balanceOf
, transfer
, transferFrom
, approve
, totalSupply
etc
💡 balanceOf
will always return the most up to date balance of the user, which includes their principal balance + the yield generated by the principal balance.
function DOMAIN_SEPARATOR()
Get the domain separator for the token at current chain.
function nonces(address owner)
Returns the nonce value for address specified as parameter. This is the nonce used when calling permit()
function scaledBalanceOf(address user)
Returns the scaled supply balance of user
. The scaled balance is the sum of all the updated stored balance divided by the reserve's liquidity index at the moment of the update.
function getScaledUserBalanceAndSupply(address user)
Returns the scaled balance of the user and the scaled total supply.
function scaledTotalSupply()
Returns the scaled total supply of the tToken.
function getPreviousIndex(address user)
Returns last index interest that was accrued to the user's balance (expressed in ray).
function getIncentivesController()
Returns the address of the Incentives Controller contract
function POOL()
Returns the address of the associated Pool for the tToken.
function UNDERLYING_ASSET_ADDRESS()
Returns address of the underlying reserve asset.
function RESERVE_TREASURY_ADDRESS()
Returns address of the Treasury, controlled by governance, receiving the fee on this aToken.
function setIncentivesController(IIncentivesController controller)
Sets a new Incentives Controller.
Only Pool Admin can call this methods. To update Incentives Controller on main Themis market, Governance Proposal must be submitted.
Allows a user to permit another account (or contract) to use their funds using a signed message. This enables gas-less transactions and single approval/transfer transactions.
|Name|Type|Description| |owner|address| The owner of the funds| |spender|address| The spender for the funds| |value|uint256| The amount the spender is permitted to use| |deadline|uint256| The deadline timestamp that the permit is valid. Use type(uint).max for no deadline.| |v|uint8| Signature parameter| |r|bytes32| Signature parameter| |s|bytes32| Signature parameter|
How tToken earn interest? / How tToken balance increases?
Pool methods (deposit, withdraw, borrow, repay, liquidationCall) updates the state and cumulated liquidity index of the reserve once every block. tToken's balanceOf method returns the balance computed based on block.timestamp
and liquidityIndex
of the underlying reserve and hence, returns the most up to date balance of account, which includes principal
+ interest
.
LiquidityRate vs LiquidityIndex
Can I transfer tTokens? Yes! with few caveat to keep in mind
By transferring tTokens, you’re transferring your balance of the underlying asset. Only the account holding the tTokens can withdraw the deposited asset.
AToken transfer will fail if the resulting Health Factor of user will end up being below 1.
If I transfer tToken does my pending liquidity rewards get transferred? No, liquidity rewards earned prior to the transfer of tToken are accrued by the user/address holding the tTokens originally. Though, all future liquidity rewards will be earned by the new recepient.
What is the difference between ScaledBalance and Balance?
Example please! Let’s say you supply 1,000 DAI to the Themis Pool, you will receive 1,000 tDAI (at 1:1 exchange rate). You can see your tDAI balance increasing right away. Now, say a month later your tDAI balance is 1,050. You could withdraw 1,050 DAI from LendingPool by burning 1050 tDAI.
Contract that returns an array of all reserve incentives or user claimable rewards within a particular market, used by theThemis Interface to display incentives data. TheThemis Utilities SDK includes an interface to make calls to this contract, and functions to format the response for frontend use-cases.
underlyingAsset
address
Address of the asset supplied/borrowed in Pool
aIncentiveData
IncentiveData
Details of rewards distributed for supplying to Pool i.e. rewards for aToken holders.
vIncentiveData
IncentiveData
Details of rewards distributed for variable debt borrowed from Themis Pool i.e. rewards for vToken holders.
sIncentiveData
IncentiveData
Details of rewards distributed for stable debt borrowed from Themis Pool i.e. rewards for sToken holders.
tokenAddress
address
Address of corresponding t/s/vToken.
incentiveControllerAddress
address
Address of Rewards Controller
rewardsTokenInformation
RewardInfo[]
Array of details for all reward tokens that are available for given t/s/vToken
rewardTokenSymbol
string
Symbol of Reward Token
rewardTokenAddress
address
Address of Reward Token
rewardOracleAddress
address
Price Oracle for Reward token
emissionPerSecond
uint256
Reward Token emitted per second
incentivesLastUpdateTimestamp
uint256
Unix timestamp of last update made on asset’s reward token.
tokenIncentivesIndex
uint256
Latest distribution index of the reward token
emissionEndTimestamp
uint256
Unix timestamp of when the Incentive emission of given reward token ends for the corresponding asset
rewardPriceFeed
int256
Latest answer/price from reward token price oracle
rewardTokenDecimals
uint8
Decimals of reward token
precision
uint8
Decimals of asset token (t/s/vToken)
priceFeedDecimals
uint8
Decimals of price provided by oracle
underlyingAsset
address
Address of the asset supplied/borrowed in Pool
aTokenIncentivesUserData
UserIncentiveData
Details of user rewards received for supplying to Themis Pool i.e. rewards for aToken.
vTokenIncentivesUserData
UserIncentiveData
Details of user rewards received for borrowing at variable rate from Themis Pool i.e. rewards for vToken.
sTokenIncentivesUserData
UserIncentiveData
Details of user rewards received for borrowing at stable rate from Themis Pool i.e. rewards for sToken.
tokenAddress
address
Address of corresponding t/s/vToken.
incentiveControllerAddress
address
Address of Rewards Controller for reward claim tx
userRewardsInformation
UserRewardInfo[]
Array of details for all reward tokens accrued/claimed by user for given t/s/vToken
rewardTokenSymbol
string
Symbol of Reward Token
rewardOracleAddress
address
Price Oracle for Reward token
rewardTokenAddress
address
Address of Reward Token
userUnclaimedRewards
uint256
User’s unclaimed rewards
tokenIncentivesUserIndex
uint256
Latest user distribution index
rewardPriceFeed
int256
Latest answer/price from reward token price oracle
priceFeedDecimals
uint8
Decimals of price provided by oracle
rewardTokenDecimals
uint8
Decimals of reward token
function getReservesIncentivesData(IPoolAddressesProvider provider)
Returns AggregatedReserveIncentiveData[]
for the pool associated with given provide.
function getUserReservesIncentivesData(IPoolAddressesProvider provider, address user)
Returns UserReserveIncentiveData[]
for the given user for the pool associated with given.
function getFullReservesIncentiveData(IPoolAddressesProvider provider, address user)
Returns both AggregatedReserveIncentiveData[]
and UserReserveIncentiveData[]
for the given user for the pool associated with the given provider.
M1CollateralValueCalculator
Aggregation contracts used to calculate the value of M1 collateral.
function getAssetInBaseCurrency(address asset,uint256 amounts, address oracle) override public view returns (uint256)
Calculate the value of a specified amount of assets
assets
address
contract address of assets
amounts
uint256
the evaluated amount of assets
oracle
address
Underlying asset take-or-pay contracts in collateral assets
uint256
Returns the value of the specified amount of assets passed in.
function getSingleLpInBaseCurrency(address lpContractAddress, uint256 lpAmounts, address oracle) external view returns (uint256);
Calculate the value of the specified amount of LP token
lpContractAddress
address
token address of the LP token
lpAmounts
uint256
the amount need to be evaluate
oracle
address
Underlying asset take-or-pay contracts in collateral assets
uint256
The evaluated results
function getUniswapV2InBaseCurrency(address v2Pair, uint256 lpAmounts, address oracle) external view returns (uint256)
计算Uniswap v2 LP token数量的价值
v2Pair
address
the pool address ofUniswap V2 LP
lpAmounts
uint256
the amount need to be evaluate
oracle
address
Underlying asset take-or-pay contracts in collateral assets
uint256
The evaluated results to the corresponding asset and amount.
function getUniswapV2LpAmounts(address v2Pair, uint256 lpAmounts) external view returns (address token0, address token1, uint256 amount0, uint256 amount1)
Get the address and number of underlying asset contracts corresponding to the number of Uniswap v2 LP tokens.
v2Pair
address
the pool address ofUniswap V2 LP
lpAmounts
uint256
the LP amount need to be evaluate
token0
address
Uniswap v2 LP corresponds to the token0 contract address.
token1
address
Uniswap v2 LP corresponds to the token1 contract address.
amount0
uint256
The amount of assets corresponding to token0 for Uniswap v2 LP.
amount1
uint256
The amount of assets corresponding to token1 for Uniswap v2 LP.
function getUniswapV3NFTInBaseCurrency( address nonfungiblePositionManagerAddress, uint256 tokenId, address oracle) external view returns (uint256);
Get the value of Uniswap v3 NFT
nonfungiblePositionManagerAddress
address
Each pair of Uniswap is grouped under a single administrative address. They have different token IDs but the same address.
tokenId
uint256
token id
oracle
address
Underlying asset take-or-pay contracts in collateral assets
uint256
Returns the value of the token ID passed into Uniswap v3.
function getUniswapV3NFTAmounts(uint256 tokenId, address nonfungiblePositionManagerAddress) external view returns (address token0, address token1, uint24 fee, uint256 amount0, uint256 amount1);
Get the address of the underlying asset contract corresponding to Uniswap v3 NFT and its amount.
The number of assets in Uniswap V3 NFT changes all the time, and the Pool is able to monitor it in real-time.
tokenId
uint256
token id
nonfungiblePositionManagerAddress
address
Uniswap v3's nft position manager address
token0
address
Uniswap v3 NFT corresponds to token0 contract address.
token1
address
Uniswap v3 NFT corresponds to token1 contract address.
fee
uint256
The uncollected fee of the NFT
amount0
uint256
Uniswap v3 NFT amount of assets corresponding to token0.
amount1
uint256
Uniswap v3 NFT amount of assets corresponding to token1.
function getUniswapV3NFTPoolAddress(uint256 tokenId, address nonfungiblePositionManagerAddress) external view returns(address)
Get the address of the pool contract corresponding to the tokenId
of Uniswap v3
tokenId
uint256
token id
nonfungiblePositionManagerAddress
address
Uniswap v3's nft position manager address
address
Uniswap v3 NFT corresponds to the contract address of the pool.
function getUniswapV3NFTInBaseCurrencyV2( address nonfungiblePositionManagerAddress, uint256 tokenId, address oracle) external view returns (uint256 currencyValue,address token0, address token1, uint256 fee , uint256 amount0, uint256 amount1);
Get the value of Uniswap v3 and basic information about the underlying assets
nonfungiblePositionManagerAddress
address
Uniswap v3's nft position manager address
tokenId
uint256
token id
oracle
address
Underlying asset take-or-pay contracts in collateral assets
currencyValue
uint256
Returns the value of the tokenid
of Uniswap v3.
token0
address
Uniswap v3 NFT corresponds to token0 contract address.
token1
address
Uniswap v3 NFT corresponds to token1 contract address.
fee
uint256
Uniswap v3 uncollected fee
amount0
uint256
the amount of assets corresponding to token0 in the NFT.
amount1
uint256
the amount of assets corresponding to token1 in the NFT.
Contract that returns an array of all reserve or user data for a particular market, used by the to display Markets and Dashboard data. The includes an interface to make calls to this contract, and functions to format the response for frontend use-cases.
View fields of AggregatedReserveData defined at .
Info data struct for the base currency of the Themis protocol market.
function getReservesList(IPoolAddressesProvider provider)
function getReservesData(IPoolAddressesProvider provider)
function getUserReservesData(IPoolAddressesProvider provider, address user)
Returns the list of initialised reserves in the Pool associated with the given .
Returns BaseCurrencyInfo
of the Pool and AggregatedReserveData[]
for all the initialised reserves in the Pool associated with the given .
Returns UserReserveData[]
for all user reserves in the Pool associated with the given .
marketReferenceCurrencyUnit
uint256
Reference aka base currency of the market
marketReferenceCurrencyPriceInUsd
int256
Price of reference aka base currency in USD
networkBaseTokenPriceInUsd
int256
Price of native token of the network/chain in USD
networkBaseTokenPriceDecimals
uint8
Decimals of native token of the network/chain
underlyingAsset
address
Address of the underlying asset supplied/borrowed
scaledATokenBalance
uint256
scaled balance of tToken scaledBalance = balance/liquidityIndex
usageAsCollateralEnabledOnUser
bool
true if supplied asset is enabled to be used as collateral
stableBorrowRate
uint256
Stable rate at which underlying asset is borrowed by the user. 0 ⇒ no debt
scaledVariableDebt
uint256
scaled balance of vToken scaledBalance = balance/liquidityIndex
principalStableDebt
uint256
Principal amount borrowed at stable rate
stableBorrowLastUpdateTimestamp
uint256
unix timestamp of last update on user’s stable borrow position.