Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
bump RWA oracle price + test
Browse files Browse the repository at this point in the history
  • Loading branch information
SidestreamColdMelon committed Nov 24, 2023
1 parent cb709f4 commit bbe0e5a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
22 changes: 21 additions & 1 deletion src/DssSpell.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ import "dss-exec-lib/DssExec.sol";
import "dss-exec-lib/DssAction.sol";
import { VatAbstract } from "dss-interfaces/dss/VatAbstract.sol";

interface RwaLiquidationOracleLike {
function bump(bytes32 ilk, uint256 val) external;
}

contract DssSpellAction is DssAction {
// Provides a descriptive tag for bot consumption
string public constant override description = "Goerli Spell";
Expand Down Expand Up @@ -53,16 +57,21 @@ contract DssSpellAction is DssAction {

// ---------- Math ----------
uint256 internal constant THOUSAND = 10 ** 3;
uint256 internal constant MILLION = 10 ** 6;
uint256 internal constant BILLION = 10 ** 9;
uint256 internal constant WAD = 10 ** 18;
uint256 internal constant RAD = 10 ** 45;

// ---------- SBE parameter changes ----------
address internal immutable MCD_VOW = DssExecLib.vow();
address internal immutable MCD_FLAP = DssExecLib.flap();

// ---------- Debt Ceiling ----------
// ---------- Reduce PSM-GUSD-A Debt Ceiling ----------
VatAbstract internal immutable vat = VatAbstract(DssExecLib.vat());

// ---------- Increase RWA014-A (Coinbase Custody) Debt Ceiling ----------
address internal immutable MIP21_LIQUIDATION_ORACLE = DssExecLib.getChangelogAddress("MIP21_LIQUIDATION_ORACLE");

function actions() public override {
// ---------- Stability Fee Changes ----------
// Forum: https://forum.makerdao.com/t/stability-scope-parameter-changes-7/22882#increase-rwa014-a-coinbase-custody-debt-ceiling-9
Expand Down Expand Up @@ -96,6 +105,17 @@ contract DssSpellAction is DssAction {
// Increase the RWA014-A (Coinbase Custody) debt ceiling by 1b DAI, from 500M to 1.5b
DssExecLib.increaseIlkDebtCeiling("RWA014-A", 1 * BILLION, /* global = */ true);

// Note: we have to bump the oracle price to account for the new DC
// Note: the formula is `Debt ceiling * [ (1 + RWA stability fee ) ^ (minimum deal duration in years) ] * liquidation ratio`
// Note: as stability fee is 0 for this deal, this should be equal to ilk DC
RwaLiquidationOracleLike(MIP21_LIQUIDATION_ORACLE).bump(
"RWA014-A",
1500 * MILLION * WAD
);

// Note: we have to update collateral price to propagate the changes
DssExecLib.updateCollateralPrice("RWA014-A");

// ---------- SBE parameter changes ----------
// Forum: https://forum.makerdao.com/t/smart-burn-engine-transaction-analysis-parameter-reconfiguration-update-3/22876

Expand Down
24 changes: 22 additions & 2 deletions src/DssSpell.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,16 @@ interface BridgeLike {
function l2TeleportGateway() external view returns (address);
}

interface SpellActionLike {
function dao_resolutions() external view returns (string memory);
}

interface ProxyLike {
function exec(address target, bytes calldata args) external payable returns (bytes memory out);
}

interface SpellActionLike {
function dao_resolutions() external view returns (string memory);
interface RwaLiquidationOracleLike {
function ilks(bytes32) external view returns (string memory, address, uint48 toc, uint48 tau);
}

contract DssSpellTest is DssSpellTestBase {
Expand Down Expand Up @@ -545,4 +549,20 @@ contract DssSpellTest is DssSpellTestBase {
}

// SPELL-SPECIFIC TESTS GO BELOW

// RWA tests
RwaLiquidationOracleLike oracle = RwaLiquidationOracleLike(addr.addr("MIP21_LIQUIDATION_ORACLE"));
function testRWApriceBump() public {
_vote(address(spell));
_scheduleWaitAndCast(address(spell));
assertTrue(spell.done());

// Get the oracle address
(,address pip,, ) = oracle.ilks("RWA014-A");
assertEq(uint256(DSValueAbstract(pip).read()), 1_500_000_000 * WAD, "RWA014: Bad pip value after bump()");

// Get collateral's parameters
(,, uint256 spot,,) = vat.ilks("RWA014-A");
assertEq(spot, 1_500_000_000 * RAY, "RWA014: Bad spot value after bump()");
}
}

0 comments on commit bbe0e5a

Please sign in to comment.