This function sets the borrow interest rate utilization curve kink for the Compound III base asset. In addition to supplying, borrowing, and wrapping, the bulker contract can also transfer collateral within the protocol and claim rewards. Accounts can also earn interest by supplying the base asset to the protocol.
The base asset can be borrowed using the withdraw function; the resulting borrow balance must meet the borrowing collateral factor requirements. Collateral can only be added if the market is below its supplyCap, which limits the protocol’s risk exposure to collateral assets. This function sets the minimum amount of base asset supplied to the protocol in order for accounts to accrue rewards.
- This function sets the Comet contract’s ERC-20 allowance of an asset for a manager address.
- The v3 proxy is the only address to be used to interact with a Compound III instance.
- The configurator deploys implementations of the Comet logic contract according to its configuration.
- Successful execution of one of these functions triggers the accrueInterest method, which causes interest to be added to the underlying balance of every supplier and borrower in the market.
- Please join the #development room in the Compound community Discord server; Compound Labs and members of the community look forward to helping you build an application on top of Compound.
- This function sets the borrow interest rate utilization curve kink for the Compound III base asset.
Update Liquidation Collateral Factor
An account balance greater than zero indicates the base asset is supplied and a balance less than zero indicates the base asset is borrowed. For instance, if the borrow collateral factor for WBTC is 85%, an account can borrow up to 85% of the USD value of its supplied WBTC in the base asset. This function returns the minimum borrow balance allowed in the base asset. This function returns the current balance of a collateral asset for a specified account in the protocol. This function can be used to supply collateral, supply the base asset, or repay an open borrow of the base asset.
Set Governor
This is used to add additional functionality without requiring contract space in the main protocol contract. Do not interact with this contract directly; instead use the cUSDCv3 proxy address with the Comet Interface ABI. This is the implementation of the market logic contract, as deployed by the Comet Factory via the Configurator. The address is fixed and independent from future upgrades to the market. This is the main proxy contract for interacting with the first Compound III market.
- The governance system has control over each proxy, the Configurator implementation, the Comet factory, and the Comet implementation.
- Prices and exchange rates are scaled by the decimals unique to each asset; cTokens are ERC-20 tokens with 8 decimals, while their underlying tokens vary, and have a public member named decimals.
- The first is on behalf of the caller, the second is to a separate account, and the third is for a manager on behalf of an account.
- Users can add collateral assets to their account using the supply function.
- There is no underlying contract for ETH, so to do this with cETH, set underlyingDecimals to 18.
Interpreting Exchange Rates
Withdraw is also used to borrow the base asset from the protocol if the account has supplied sufficient collateral. If the base asset is supplied resulting in the account having a balance greater than zero, the base did you have any interest or dividend income asset earns interest based on the current supply rate. Compound III is an EVM compatible protocol that enables supplying of crypto assets as collateral in order to borrow the base asset.
The Compound protocol contracts use a system of exponential math, Exponential.sol, in order to represent fractional quantities with sufficient precision. We believe that size, visibility, and time are the true test for the security of a smart contract; please exercise caution, and make your own determination of security and suitability. All contract code and balances are publicly verifiable, and security researchers are eligible for a bug bounty for reporting undiscovered vulnerabilities. This is a rewards contract which can hold rewards tokens (e.g. COMP, WETH) and allows claiming rewards by users, according to the core protocol tracking indices. This is the implementation of the Configurator contract, which can also be upgraded to support unforeseen changes to the protocol.
Set Asset Supply Cap
This function sets the supply interest rate slope low bound in the approximate amount of seconds in one year. This function sets the borrow interest rate slope high bound in the approximate amount of seconds in one year. This function sets the borrow interest rate slope low bound in the approximate amount of seconds in one year. This function sets the official contract address of the Comet factory.
Calculating the APR Using Rate Per Block
This function returns true if the account passed to it has non-negative liquidity based on the borrow collateral factors. The supply function transfers an asset to the protocol and adds it to the account’s balance. Users can add collateral assets to their account using the supply function. Once the protocol reaches this amount of reserves of base asset, liquidators cannot buy collateral from the protocol. This function sets the rate at which base asset supplier accounts accrue rewards. This function sets the supply interest rate utilization curve kink for the Compound III base asset.
Is Supply Paused
This function modifies an existing asset’s configuration parameters. The methods in CometExt.sol are able to be called via the same proxy as Comet.sol. The only addresses that are allowed to call this function are the actual vs applied overhead Governor and the Pause Guardian.
Calculating the APY Using Rate Per Block
This function sets the rate at which base asset borrower accounts accrue rewards. This function sets the official contract address of the price feed of the protocol base asset. Interest rates for each market update on any block in which the ratio of borrowed assets to supplied assets in the market has changed.
The network deployment artifacts with contract addresses are available in the Comet repository deployments/ folder. Interest accrues for the current block, as well as each prior block in which the accrueInterest method was not triggered (no user interacted with the cToken contract). See the interest rate data visualization notebook on Observable to visualize which interest rate model is currently applied to each market.
Successful execution of one of these functions triggers the accrueInterest method, which causes interest to be added to the underlying balance of every supplier and borrower in the market. Global indices for supply and borrow are unsigned integers that increase over time to account for the interest accrued on each side. Each collateral asset increases the user’s borrowing capacity, based on the asset’s borrowCollateralFactor.
An account’s initial borrow size must be equal to or greater than this value. The first is on behalf of the caller, the second is to a separate account, and the third is for a manager on behalf of an account. An account’s present balance can be calculated using the current index with the following formulas. When an account interacts with the protocol, the indices are updated and saved. The borrowing collateral factors are percentages that represent the portion of collateral value that can be borrowed. This function updates the liquidation factor for an asset in the protocol.
This function sets the supply interest rate slope base in the approximate amount of seconds in one year. This function sets the borrow interest rate slope base in the approximate amount of seconds in one year. This function sets the official contract address of the protocol’s Comet extension delegate. This function returns a boolean indicating whether or not the protocol absorb functionality is presently paused. This function returns a boolean indicating whether or not the protocol withdraw functionality is presently paused.
This function pauses the specified protocol functionality in the event of an unforeseen vulnerability. COMP token-holders designate the Pause Guardian address, which is held by the Community Multi-Sig. Each deployment outside of Mainnet needs to have a Bridge Receiver and Local Timelock contract on its chain.
The configurator deploys implementations of the Comet logic contract according to its configuration. This is a proxy contract for the configurator, which is used to set and update parameters of a Comet proxy contract. To generate the proper Comet Interface ABI (CometInterface.sol), compile the Comet project using yarn compile. The v3 proxy is the only address to be used to interact with a Compound III instance.
This is an external contract that is not integral to Comet’s function. This is the factory contract capable of producing instances of the Comet implementation/logic contract, and invoked by the Configurator. This pattern allows significant gas savings for users of the protocol by ‘constantizing’ the parameters of the protocol.
Read on to discover how to maximize your returns. A return value of false does not necessarily imply that the account is presently liquidatable (see isLiquidatable function). Account balances are stored internally in sales returns and allowances Comet as principal values (also signed integers). Supply transactions will revert if the total supply would be greater than this number as a result. The liquidation factor is a decimal value that is between 0 and 1 (inclusive) which determines the amount that is paid out to an underwater account upon liquidation.