Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
amusingaxl committed Sep 26, 2023
1 parent 29a8c6e commit 9243c29
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 226 deletions.
146 changes: 5 additions & 141 deletions src/DssSpell.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,16 @@ pragma solidity 0.8.16;
import "dss-exec-lib/DssExec.sol";
import "dss-exec-lib/DssAction.sol";

import { GemAbstract } from "dss-interfaces/ERC/GemAbstract.sol";

interface DenyLike {
function deny(address usr) external;
}

interface ChainlogLike {
function removeAddress(bytes32) external;
}

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

contract DssSpellAction is DssAction {
// Provides a descriptive tag for bot consumption
// This should be modified weekly to provide a summary of the actions
// Hash: cast keccak -- "$(wget 'https://raw.githubusercontent.com/makerdao/community/ef206389a490089bd06e64c574038f07bfbb7569/governance/votes/Executive%20vote%20-%20September%2013%2C%202023.md' -q -O - 2>/dev/null)"
// Hash: cast keccak -- "$(wget 'TODO' -q -O - 2>/dev/null)"
string public constant override description =
"2023-09-13 MakerDAO Executive Spell | Hash: 0x214ab69eb9c381276e409b9c58c74a6e090f1105992fabc8986d88091121765f";

GemAbstract internal immutable MKR = GemAbstract(DssExecLib.mkr());

address internal immutable MCD_VAT = DssExecLib.vat();
address internal immutable MCD_CAT = DssExecLib.cat();
address internal immutable MCD_PAUSE_PROXY = DssExecLib.pauseProxy();
"2023-09-30 MakerDAO Executive Spell | Hash: TODO";

// Set office hours according to the summary
function officeHours() public pure override returns (bool) {
Expand All @@ -55,9 +39,6 @@ contract DssSpellAction is DssAction {
// Poll: https://vote.makerdao.com/polling/QmNgKzcG
// Approve DAO resolution hash QmXU2TwsRpVevGY74NVFbD9bKwtsw1mSuSce7My1zinD9m

// Comma-separated list of DAO resolutions IPFS hashes.
string public constant dao_resolutions = "QmXU2TwsRpVevGY74NVFbD9bKwtsw1mSuSce7My1zinD9m";

// Many of the settings that change weekly rely on the rate accumulator
// described at https://docs.makerdao.com/smart-contract-modules/rates-module
// To check this yourself, use the following rate calculation (example 8%):
Expand All @@ -69,140 +50,23 @@ contract DssSpellAction is DssAction {
//
// uint256 internal constant X_PCT_RATE = ;

uint256 internal constant THREE_PT_FOUR_FIVE_PCT_RATE = 1000000001075539644270067964;
uint256 internal constant THREE_PT_SEVEN_ZERO_PCT_RATE = 1000000001152077919467240095;
uint256 internal constant FOUR_PT_TWO_ZERO_PCT_RATE = 1000000001304602465690389263;

// ----------- MKR transfer Addresses -----------
address internal constant DECO_WALLET = 0xF482D1031E5b172D42B2DAA1b6e5Cbf6519596f7;
address internal constant SES_WALLET = 0x87AcDD9208f73bFc9207e1f6F0fDE906bcA95cc6;

address internal constant DEFENSOR = 0x9542b441d65B6BF4dDdd3d4D2a66D8dCB9EE07a9;
address internal constant TRUENAME = 0x612F7924c367575a0Edf21333D96b15F1B345A5d;
address internal constant BONAPUBLICA = 0x167c1a762B08D7e78dbF8f24e5C3f1Ab415021D3;
address internal constant VIGILANT = 0x2474937cB55500601BCCE9f4cb0A0A72Dc226F61;
address internal constant NAVIGATOR = 0x11406a9CC2e37425F15f920F494A51133ac93072;
address internal constant QGOV = 0xB0524D8707F76c681901b782372EbeD2d4bA28a6;
address internal constant UPMAKER = 0xbB819DF169670DC71A16F58F55956FE642cc6BcD;
address internal constant PALC = 0x78Deac4F87BD8007b9cb56B8d53889ed5374e83A;
address internal constant PBG = 0x8D4df847dB7FfE0B46AF084fE031F7691C6478c2;
address internal constant CLOAKY = 0x869b6d5d8FA7f4FFdaCA4D23FFE0735c5eD1F818;
address internal constant WBC = 0xeBcE83e491947aDB1396Ee7E55d3c81414fB0D47;
address internal constant BLUE = 0xb6C09680D822F162449cdFB8248a7D3FC26Ec9Bf;

// ---------- Math ----------
uint256 internal constant MILLION = 10 ** 6;

// ---------- Spark Proxy ----------
// Spark Proxy: https://github.com/marsfoundation/sparklend/blob/d42587ba36523dcff24a4c827dc29ab71cd0808b/script/output/1/primary-sce-latest.json#L2
address internal constant SPARK_PROXY = 0x3300f198988e4C9C63F75dF86De36421f06af8c4;

// ---------- Trigger Spark Proxy Spell ----------
address internal constant SPARK_SPELL = 0x95bcf659653d2E0b44851232d61F6F9d2e933fB1;
address internal constant SPARK_SPELL = address(0); // TODO

function actions() public override {
// ---------- Stability Scope Parameter Changes ----------
// MIP: https://mips.makerdao.com/mips/details/MIP104#0-the-stability-scope
// Forum: https://forum.makerdao.com/t/stability-scope-parameter-changes-5/21969
// Increase the ETH-A Stability Fee (SF) by 0.12% from 3.58% to 3.70%.
DssExecLib.setIlkStabilityFee("ETH-A", THREE_PT_SEVEN_ZERO_PCT_RATE, /* doDrip = */ true);

// Increase the ETH-B Stability Fee (SF) by 0.12% from 4.08% to 4.20%.
DssExecLib.setIlkStabilityFee("ETH-B", FOUR_PT_TWO_ZERO_PCT_RATE, /* doDrip = */ true);

// Increase the ETH-C Stability Fee (SF) by 0.12% from 3.33% to 3.45%.
DssExecLib.setIlkStabilityFee("ETH-C", THREE_PT_FOUR_FIVE_PCT_RATE, /* doDrip = */ true);

// Activate DC-IAM for PSM-PAX-A
// Maximum Debt Ceiling (line): 120M
// Target Available Debt (gap): 50 million DAI
// Ceiling Increase Cooldown (ttl): 24 hours
DssExecLib.setIlkAutoLineParameters("PSM-PAX-A", /* line */ 120 * MILLION, /* gap */ 50 * MILLION, /* ttl */ 24 hours);

// ---------- Spark Protocol DC-IAM changes ----------
// Forum: http://forum.makerdao.com/t/upcoming-spell-proposed-changes/21801
// Poll: https://vote.makerdao.com/polling/QmQnUhZt#vote-breakdown
// Increase the Maximum Debt Ceiling from 200 million DAI to 400 million DAI.
// and
// Increase the Ceiling Increase Cooldown from 8 hours to 12 hours.
DssExecLib.setIlkAutoLineParameters("DIRECT-SPARK-DAI", /* line */ 400 * MILLION, /* gap */ 20 * MILLION, /* ttl */ 12 hours);

// ---------- Aligned Delegate Compensation for August ----------
// Forum: https://forum.makerdao.com/t/august-2023-aligned-delegate-compensation/21983

// 0xDefensor - 41.67 - 0x9542b441d65B6BF4dDdd3d4D2a66D8dCB9EE07a9
MKR.transfer(DEFENSOR, 41.67 ether); // NOTE: ether is a keyword helper, only MKR is transferred here

// TRUE NAME - 41.67 - 0x612f7924c367575a0edf21333d96b15f1b345a5d
MKR.transfer(TRUENAME, 41.67 ether); // NOTE: ether is a keyword helper, only MKR is transferred here

// BONAPUBLICA - 41.67 - 0x167c1a762B08D7e78dbF8f24e5C3f1Ab415021D3
MKR.transfer(BONAPUBLICA, 41.67 ether); // NOTE: ether is a keyword helper, only MKR is transferred here

// vigilant - 41.67 - 0x2474937cB55500601BCCE9f4cb0A0A72Dc226F61
MKR.transfer(VIGILANT, 41.67 ether); // NOTE: ether is a keyword helper, only MKR is transferred here

// Navigator - 28.23 - 0x11406a9CC2e37425F15f920F494A51133ac93072
MKR.transfer(NAVIGATOR, 28.23 ether); // NOTE: ether is a keyword helper, only MKR is transferred here

// QGov - 20.16 - 0xB0524D8707F76c681901b782372EbeD2d4bA28a6
MKR.transfer(QGOV, 20.16 ether); // NOTE: ether is a keyword helper, only MKR is transferred here

// UPMaker - 13.89 - 0xbb819df169670dc71a16f58f55956fe642cc6bcd
MKR.transfer(UPMAKER, 13.89 ether); // NOTE: ether is a keyword helper, only MKR is transferred here

// PALC - 13.89 - 0x78Deac4F87BD8007b9cb56B8d53889ed5374e83A
MKR.transfer(PALC, 13.89 ether); // NOTE: ether is a keyword helper, only MKR is transferred here

// PBG - 13.89 - 0x8D4df847dB7FfE0B46AF084fE031F7691C6478c2
MKR.transfer(PBG, 13.89 ether); // NOTE: ether is a keyword helper, only MKR is transferred here

// Cloaky - 7.17 - 0x869b6d5d8FA7f4FFdaCA4D23FFE0735c5eD1F818
MKR.transfer(CLOAKY, 7.17 ether); // NOTE: ether is a keyword helper, only MKR is transferred here

// WBC - 6.72 - 0xeBcE83e491947aDB1396Ee7E55d3c81414fB0D47
MKR.transfer(WBC, 6.72 ether); // NOTE: ether is a keyword helper, only MKR is transferred here

// BLUE - 1.25 - 0xb6c09680d822f162449cdfb8248a7d3fc26ec9bf
MKR.transfer(BLUE, 1.25 ether); // NOTE: ether is a keyword helper, only MKR is transferred here

// ---------- Decrease Debt Ceiling for Fortunafi (RWA005-A) to 0 ----------
// Decrease Debt Ceiling from 15 million DAI to 0 (zero)
// Forum: http://forum.makerdao.com/t/request-to-poll-offboarding-legacy-legal-recourse-assets/21582
// Poll: https://vote.makerdao.com/polling/Qmcb1c9x

DssExecLib.decreaseIlkDebtCeiling("RWA005-A", 15 * MILLION, /* global = */ true);
// ---------- Section Separator ----------

// ---------- Trigger Spark Proxy Spell ----------
// Poll: https://vote.makerdao.com/polling/QmQrkxud
// Poll 2: https://vote.makerdao.com/polling/QmbCDKof
// TODO
ProxyLike(SPARK_PROXY).exec(SPARK_SPELL, abi.encodeWithSignature("execute()"));


// ---------- Core Unit MKR Vesting Transfers ----------
// DECO-001 - 125 MKR - 0xF482D1031E5b172D42B2DAA1b6e5Cbf6519596f7
// MIP: https://mips.makerdao.com/mips/details/MIP40c3SP36#sentence-summary
MKR.transfer(DECO_WALLET, 125 ether); // NOTE: ether is a keyword helper, only MKR is transferred here

// SES-001 - 34.94 MKR - 0x87acdd9208f73bfc9207e1f6f0fde906bca95cc6
// MIP: https://mips.makerdao.com/mips/details/MIP40c3SP17#sentence-summary
MKR.transfer(SES_WALLET, 34.94 ether); // NOTE: ether is a keyword helper, only MKR is transferred here

// ---------- Scuttle MCD_CAT ----------
// Forum: http://forum.makerdao.com/t/proposal-to-scuttle-mcd-cat-upcoming-executive-spell-2023-09-13/21958

// Remove MCD_CAT from the Chainlog
ChainlogLike(DssExecLib.LOG).removeAddress("MCD_CAT");

// Revoke MCD_CAT access to MCD_VAT: vat.deny(cat)
DenyLike(MCD_VAT).deny(MCD_CAT);

// Yield ownership of MCD_CAT: cat.deny(pauseProxy)
DenyLike(MCD_CAT).deny(MCD_PAUSE_PROXY);

// Bump chainlog version
// Justification: The MINOR version is updated as core MCD_CAT contract is being removed in this spell
DssExecLib.setChangelogVersion("1.17.0");
}
}

Expand Down
146 changes: 67 additions & 79 deletions src/DssSpell.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ interface BridgeLike {
function l2TeleportGateway() external view returns (address);
}

interface WardsLike {
function wards(address) external view returns (uint256);
}

interface ProxyLike {
function exec(address target, bytes calldata args) external payable returns (bytes memory out);
}
Expand Down Expand Up @@ -114,8 +110,68 @@ contract DssSpellTest is DssSpellTestBase {
function testChainlogVersionBump() public {
_testChainlogVersionBump();
}

// Leave this test public (for now) as this is acting like a config test
function testPSMs() public {
_vote(address(spell));
_scheduleWaitAndCast(address(spell));
assertTrue(spell.done());

bytes32 _ilk;

// USDC
_ilk = "PSM-USDC-A";
assertEq(addr.addr("MCD_JOIN_PSM_USDC_A"), reg.join(_ilk));
assertEq(addr.addr("MCD_CLIP_PSM_USDC_A"), reg.xlip(_ilk));
assertEq(addr.addr("PIP_USDC"), reg.pip(_ilk));
assertEq(addr.addr("MCD_PSM_USDC_A"), chainLog.getAddress("MCD_PSM_USDC_A"));
_checkPsmIlkIntegration(
_ilk,
GemJoinAbstract(addr.addr("MCD_JOIN_PSM_USDC_A")),
ClipAbstract(addr.addr("MCD_CLIP_PSM_USDC_A")),
addr.addr("PIP_USDC"),
PsmAbstract(addr.addr("MCD_PSM_USDC_A")),
0, // tin
0 // tout
);

// GUSD
_ilk = "PSM-GUSD-A";
assertEq(addr.addr("MCD_JOIN_PSM_GUSD_A"), reg.join(_ilk));
assertEq(addr.addr("MCD_CLIP_PSM_GUSD_A"), reg.xlip(_ilk));
assertEq(addr.addr("PIP_GUSD"), reg.pip(_ilk));
assertEq(addr.addr("MCD_PSM_GUSD_A"), chainLog.getAddress("MCD_PSM_GUSD_A"));
_checkPsmIlkIntegration(
_ilk,
GemJoinAbstract(addr.addr("MCD_JOIN_PSM_GUSD_A")),
ClipAbstract(addr.addr("MCD_CLIP_PSM_GUSD_A")),
addr.addr("PIP_GUSD"),
PsmAbstract(addr.addr("MCD_PSM_GUSD_A")),
0, // tin
0 // tout
);

// USDP
_ilk = "PSM-PAX-A";
assertEq(addr.addr("MCD_JOIN_PSM_PAX_A"), reg.join(_ilk));
assertEq(addr.addr("MCD_CLIP_PSM_PAX_A"), reg.xlip(_ilk));
assertEq(addr.addr("PIP_PAX"), reg.pip(_ilk));
assertEq(addr.addr("MCD_PSM_PAX_A"), chainLog.getAddress("MCD_PSM_PAX_A"));
_checkPsmIlkIntegration(
_ilk,
GemJoinAbstract(addr.addr("MCD_JOIN_PSM_PAX_A")),
ClipAbstract(addr.addr("MCD_CLIP_PSM_PAX_A")),
addr.addr("PIP_PAX"),
PsmAbstract(addr.addr("MCD_PSM_PAX_A")),
0, // tin
0 // tout
);
}

// END OF TESTS THAT SHOULD BE RUN ON EVERY SPELL

// TESTS BELOW CAN BE ENABLED/DISABLED ON DEMAND

function testOsmAuth() private { // make private to disable
// address ORACLE_WALLET01 = 0x4D6fbF888c374D7964D56144dE0C0cFBd49750D3;

Expand Down Expand Up @@ -171,7 +227,7 @@ contract DssSpellTest is DssSpellTestBase {
//assertEq(OsmAbstract(0xF15993A5C5BE496b8e1c9657Fd2233b579Cd3Bc6).wards(ORACLE_WALLET01), 1);
}

function testRemoveChainlogValues() public { // make private to disable
function testRemoveChainlogValues() private { // make private to disable
_vote(address(spell));
_scheduleWaitAndCast(address(spell));
assertTrue(spell.done());
Expand Down Expand Up @@ -265,7 +321,7 @@ contract DssSpellTest is DssSpellTestBase {
assertTrue(lerp.done());
}

function testNewChainlogValues() public { // make private to disable
function testNewChainlogValues() private { // make private to disable
_vote(address(spell));
_scheduleWaitAndCast(address(spell));
assertTrue(spell.done());
Expand Down Expand Up @@ -314,63 +370,6 @@ contract DssSpellTest is DssSpellTestBase {
assertEq(MedianAbstract(TOKENUSD_MED).bud(SET_TOKEN), 1);
}

// Leave this test public (for now) as this is acting like a config test
function testPSMs() public {
_vote(address(spell));
_scheduleWaitAndCast(address(spell));
assertTrue(spell.done());

bytes32 _ilk;

// USDC
_ilk = "PSM-USDC-A";
assertEq(addr.addr("MCD_JOIN_PSM_USDC_A"), reg.join(_ilk));
assertEq(addr.addr("MCD_CLIP_PSM_USDC_A"), reg.xlip(_ilk));
assertEq(addr.addr("PIP_USDC"), reg.pip(_ilk));
assertEq(addr.addr("MCD_PSM_USDC_A"), chainLog.getAddress("MCD_PSM_USDC_A"));
_checkPsmIlkIntegration(
_ilk,
GemJoinAbstract(addr.addr("MCD_JOIN_PSM_USDC_A")),
ClipAbstract(addr.addr("MCD_CLIP_PSM_USDC_A")),
addr.addr("PIP_USDC"),
PsmAbstract(addr.addr("MCD_PSM_USDC_A")),
0, // tin
0 // tout
);

// GUSD
_ilk = "PSM-GUSD-A";
assertEq(addr.addr("MCD_JOIN_PSM_GUSD_A"), reg.join(_ilk));
assertEq(addr.addr("MCD_CLIP_PSM_GUSD_A"), reg.xlip(_ilk));
assertEq(addr.addr("PIP_GUSD"), reg.pip(_ilk));
assertEq(addr.addr("MCD_PSM_GUSD_A"), chainLog.getAddress("MCD_PSM_GUSD_A"));
_checkPsmIlkIntegration(
_ilk,
GemJoinAbstract(addr.addr("MCD_JOIN_PSM_GUSD_A")),
ClipAbstract(addr.addr("MCD_CLIP_PSM_GUSD_A")),
addr.addr("PIP_GUSD"),
PsmAbstract(addr.addr("MCD_PSM_GUSD_A")),
0, // tin
0 // tout
);

// USDP
_ilk = "PSM-PAX-A";
assertEq(addr.addr("MCD_JOIN_PSM_PAX_A"), reg.join(_ilk));
assertEq(addr.addr("MCD_CLIP_PSM_PAX_A"), reg.xlip(_ilk));
assertEq(addr.addr("PIP_PAX"), reg.pip(_ilk));
assertEq(addr.addr("MCD_PSM_PAX_A"), chainLog.getAddress("MCD_PSM_PAX_A"));
_checkPsmIlkIntegration(
_ilk,
GemJoinAbstract(addr.addr("MCD_JOIN_PSM_PAX_A")),
ClipAbstract(addr.addr("MCD_CLIP_PSM_PAX_A")),
addr.addr("PIP_PAX"),
PsmAbstract(addr.addr("MCD_PSM_PAX_A")),
0, // tin
0 // tout
);
}

// @dev when testing new vest contracts, use the explicit id when testing to assist in
// identifying streams later for modification or removal
function testVestDAI() private { // make private to disable
Expand Down Expand Up @@ -603,7 +602,7 @@ contract DssSpellTest is DssSpellTestBase {
}
}

function testMKRPayments() public { // make public to enable
function testMKRPayments() private { // make public to enable
// For each payment, create a Payee object with
// the Payee address,
// the amount to be paid
Expand Down Expand Up @@ -856,10 +855,11 @@ contract DssSpellTest is DssSpellTestBase {
assertEq(Art, 0, "GUSD-A Art is not 0");
}

// Spark Tests
// SPARK TESTS

function testSparkSpellIsExecuted() public { // make private to disable
address SUBPROXY_SPARK = 0x3300f198988e4C9C63F75dF86De36421f06af8c4;
address SPARK_SPELL = 0x95bcf659653d2E0b44851232d61F6F9d2e933fB1;
address SPARK_SPELL = address(0); // TODO

vm.expectCall(
SUBPROXY_SPARK,
Expand All @@ -875,18 +875,6 @@ contract DssSpellTest is DssSpellTestBase {
assertTrue(spell.done());
}

function testScuttleMcdCat() public {
// MCD_CAT is being removed, so is not present in addresses_mainnet.sol file
WardsLike cat = WardsLike(chainLog.getAddress("MCD_CAT"));
WardsLike vat = WardsLike(addr.addr("MCD_VAT"));
assertEq(vat.wards(address(cat)), 1, "cat-not-warded-on-vat");
assertEq(cat.wards(addr.addr("MCD_PAUSE_PROXY")), 1, "pause-proxy-not-warded-on-cat");
// SPELL-SPECIFIC TESTS GO BELOW

_vote(address(spell));
_scheduleWaitAndCast(address(spell));
assertTrue(spell.done());

assertEq(vat.wards(address(cat)), 0, "cat-still-relied-on-vat");
assertEq(cat.wards(addr.addr("MCD_PAUSE_PROXY")), 0, "pause-proxy-still-relied-on-cat");
}
}
Loading

0 comments on commit 9243c29

Please sign in to comment.