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:
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 contract to determine the address for NOTE instead of hardcoding it.
The Canto DEX is built around three contracts: , , and . 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:
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
Key methods on CToken
contracts include:
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
For CANTO-specific and other methods, refer to the .
The Canto Lending Market is an adaptation of . Its functional design is unchanged in that the primary means of interacting with the lending market is the , an ERC20 representation of a supplied asset.
For more information on the Canto Lending Market's design, see the .