NOTE, DEX, and Lending Market
Last updated
Last updated
When building DApps, you may wish to leverage Canto's Free Public Infrastructure, such as its native unit of account, DEX, or lending market. This page provides an overview of how these primitives are designed and how you can interact with them.
For mainnet and testnet deployment addresses, refer to the Contract Addresses page:
NOTE must be borrowed from the Accountant via the Canto Lending Market. The amount of NOTE circulating at any given time (including NOTE that users have supplied back to the Canto Lending Market) is equal to the sum of all NOTE and cNOTE not held by the Accountant.
The NOTE smart contract may be modified and redeployed at a new address in the future. For this reason, DApps should use the CToken.underlying()
view on the cNOTE contract to determine the address for NOTE instead of hardcoding it.
The Canto DEX is built around three contracts: BaseV1Factory
, BaseV1Pair
, and BaseV1Router01
. Each liquidity pool is represented by a unique BaseV1Pair
contract generated by the BaseV1Factory
.
For most use cases, BaseV1Router01
offers sufficient functionality. Key methods include:
Method | Description |
---|---|
For CANTO-specific and other methods, refer to the contract source code.
The Canto Lending Market is an adaptation of Compound v2. Its functional design is unchanged in that the primary means of interacting with the lending market is the CToken
, an ERC20 representation of a supplied asset.
Key methods on CToken
contracts include:
For more information on the Canto Lending Market's design, see the Compound v2 docs.
Method | Description |
---|---|
mint
Deposits a token and mints the corresponding CToken
redeem
Redeems a specified amount of CToken tokens for the underlying token
redeemUnderlying
Redeems CToken tokens for a specified amount of the underlying token
borrow
Borrows the underlying token
repayBorrow
Repays a borrow of the underlying token
pairFor
Calculates the address for a pair
isPair
Checks if an address is a valid pair
getReserves
Fetches and sorts the reserves for a pair
getAmountOut
Calculates amount out for a specified pair
addLiquidity
Adds liquidity to a pair
removeLiquidity
Removes liquidity from a pair
swapExactTokensforTokensSimple
Swaps one token for another directly
swapExactTokensforTokens
Swaps one token for another using a specified route
getUnderlyingPrice
Gets underlying asset price as a mantissa