Themis V2 developer docs
Search…
⌃K
Links

Contracts Overview

Contracts Overview

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.

M0 Pool Core Contracts

Core protocol contracts fall in following 4 categories:
  • Configuration
  • Pool logic
  • Tokenization
  • Misc

Configuration

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.

Pool Logic

DefaultReserveInterestRateStrategy

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.

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.

Tokenization

TToken

Yield-generating tokens that are minted and burnt upon supply and withdraw of assets to Themis Pool

DelegationAwareTToken

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.

StableDebtToken

The non-transferable interest accruing, stable rate tokenised borrows.

VariableDebtToken

The non-transferable interest accruing, variable rate tokenised borrows.

Misc

Contract to get asset prices, manage price sources and update the fallback oracle.
Peripheral contract to collect and pre-process information from the Pool.

Peripheral Contracts

Rewards

RewardsController

This contract is responsible for configuring the different rewards and the claim process.

Transfer Strategies

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.

Misc

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.

M1 Pool Core Contracts

Core protocol contracts fall in following 4 categories:
  • Configuration
  • M1Pool logic
  • Tokenization
  • Misc

M1 Configuration

M1 Configuration is similar to M0

Pool Logic

M1Pool
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.

Tokenization

M1 tokenization configuration is Similar to M0

Misc

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
Last modified 2mo ago