Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DAIInterestRateModel to v4 (fixes #230) #231

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

fmorisan
Copy link

This patch changes the DAIInterestRateModel contract to use a SECONDS_PER_BLOCK parameter of 12, reflecting post-merge protocol changes. It also updates the IRM to look at the ETH-B stability fee in order to calculate the borrow rate, instead of using the more conservative ETH-A as a reference.

This fixes #230 and enables reactivation of the Dai Savings Rate for cDAI holders, once the contract is deployed and the IRM for cDAI is updated to the new version.

Related governance forum thread: https://www.comp.xyz/t/compound-dsr-proposal/3856

Copy link

@MathisGD MathisGD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool @fmorisan !

One question: why didn't you modified and renamed DAIInterestRateModelV3 ? I'm not sure that it is useful to keep the third version in the repo, and it would have make the changes clearer.

contracts/DAIInterestRateModelV4.sol Outdated Show resolved Hide resolved
contracts/DAIInterestRateModelV4.sol Outdated Show resolved Hide resolved
* @param owner_ The address of the owner, i.e. the Timelock contract (which has the ability to update parameters directly)
*/
constructor(uint jumpMultiplierPerYear, uint kink_, address pot_, address jug_, address owner_) JumpRateModelV2(0, 0, jumpMultiplierPerYear, kink_, owner_) public {
gapPerBlock = 4e16 / blocksPerYear;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the gap should be discussed.

ETH-B stability fee + 4% = 7%, vs 5.13% at the moment.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I get this. Should we discuss this in the governance forum?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that there is no real reason why we would keep the same as before. @monnet-supply proposed some parameters here, for example: https://www.comp.xyz/t/compound-dsr-proposal/3856/7?u=mathisgd

@fmorisan
Copy link
Author

Updated the contract and did some cleanup. Left a comment on one of the suggested changes. Thanks @MathisGD

Copy link

@MathisGD MathisGD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

The community still need to choose if the DAI's IRM should be linked to the DSR on chain or not, though (see the discussion about it here).

If this version is chosen, the gap may also be updated (ref).

The older version of BaseJumpRateModel has a blocksPerYear constant
that reflects the amount of blocks produced in a 15-second block time environment.
After the Merge, block times have gone down from 15 seconds to 12 seconds,
this being reflected in DAIInterestRateModelV4.

This brings the constant in line with the new state of the Ethereum Network.

constructor(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_, address owner_)

BaseJumpRateModelV2(baseRatePerYear,multiplierPerYear,jumpMultiplierPerYear,kink_,owner_) public {}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
BaseJumpRateModelV2(baseRatePerYear,multiplierPerYear,jumpMultiplierPerYear,kink_,owner_) public {}
BaseJumpRateModelV3(baseRatePerYear,multiplierPerYear,jumpMultiplierPerYear,kink_,owner_) public {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong seconds per block in the DAI interest rate model
3 participants