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

SIP-420: Treasury market #2354

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open

SIP-420: Treasury market #2354

wants to merge 22 commits into from

Conversation

dbeal-eth
Copy link
Contributor

@dbeal-eth dbeal-eth commented Jan 19, 2025

this implements sip-420.

notes:

  • in addition to implementing the actual contract for SIP-420, it was also necessary to add the migrateDelegation function to the core system. This is becuase it needs to be possible for a user to actually migrate their account from the current v3 SC pool without repaying their debt. (on optimism the legacymrket can be directly conneted)
  • the treasury market is designed to be able to work with other markets, preserving the portability of liquidity
  • testing a new way of testing contracts in the v3 repo. we generate a foundry script with cannon, and then run tests against the generated script. So far this seems to be working well. Coverage and everything works wrt tests. This script can even be copied anywhere since it has no dependencies (outside of forge-std).

some deployment invariants exist WRT the creation of the pool (ex. limit to only one collateral type, no minting through v3, etc.). For more information see the corresponding deployments PR Synthetixio/synthetix-deployments#619

@dbeal-eth dbeal-eth requested a review from noisekit January 19, 2025 08:36
@dbeal-eth dbeal-eth self-assigned this Jan 19, 2025
Copy link

@CalabashSquash CalabashSquash left a comment

Choose a reason for hiding this comment

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

just two nitpicks

Comment on lines +149 to +153

//
uint256 newlySaddledValue = accountCollateralValue -
(saddledCollateral[accountId] * accountCollateralValue) /
accountCollateral;

Choose a reason for hiding this comment

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

nit: should there be a comment here? I think it would be worth adding anyway

Comment on lines +290 to +292
if (power > 100) {
revert ParameterError.InvalidParameter("debtDecayPower", "too high");
}

Choose a reason for hiding this comment

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

Nit

Suggested change
if (power > 100) {
revert ParameterError.InvalidParameter("debtDecayPower", "too high");
}
if (power > 100) {
revert ParameterError.InvalidParameter("power", "too high");
}

noisekit and others added 3 commits January 23, 2025 10:29
if the loan is repaid early, an additional penalty on the amount of the
loan that had been paid so far should be charged.
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.

4 participants