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

Mainnet Spell 2024-10-31 #435

Merged
merged 27 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
70be6eb
chore: cleanup
0xdecr1pto Oct 25, 2024
7f5e8ac
chore: add spell content
0xdecr1pto Oct 25, 2024
eeb7249
chore: update dss-tests
0xdecr1pto Oct 25, 2024
c16d97a
chore: fix deprecated fail(msg)
0xdecr1pto Oct 25, 2024
93c4455
Update src/DssSpell.sol
0xdecr1pto Oct 25, 2024
8cedb8d
Update src/DssSpell.t.sol
0xdecr1pto Oct 25, 2024
4c9f948
chore: remove duplicated chainlog update
0xdecr1pto Oct 25, 2024
1817cdf
chore: add Spark ALM Proxy
0xdecr1pto Oct 25, 2024
64a899a
chore: fix revert method
0xdecr1pto Oct 25, 2024
5d79345
chore: add spark proxy
0xdecr1pto Oct 26, 2024
34398b3
chore: refactor tests for allocator
0xdecr1pto Oct 28, 2024
0aa8bba
chore: fix review comments
0xdecr1pto Oct 28, 2024
32b158e
chore: fix pr comments]
0xdecr1pto Oct 29, 2024
f0b7a18
chore: split gov relay interfaces
0xdecr1pto Oct 29, 2024
6471532
chore: fix pr comments
0xdecr1pto Oct 29, 2024
d4e8aaf
chore: more fixes
0xdecr1pto Oct 29, 2024
0908d6c
chore: refactor bridge tests & fix pr comments
0xdecr1pto Oct 30, 2024
bec261f
chore: add missing deps
0xdecr1pto Oct 30, 2024
c80a697
chore: fix comments
0xdecr1pto Oct 30, 2024
76528f9
chore: fix typo
0xdecr1pto Oct 30, 2024
36bb2d2
chore: fix comments
0xdecr1pto Oct 30, 2024
57a5fb7
chore: fix nits
0xdecr1pto Oct 30, 2024
4465576
add deployed spell info
0xdecr1pto Oct 31, 2024
7078295
archive
0xdecr1pto Oct 31, 2024
88207c7
chore: reorder var to be able to reverify contract on ethererscan
0xdecr1pto Oct 31, 2024
1f36bfa
deploy info
0xdecr1pto Oct 31, 2024
4e44a95
archive
0xdecr1pto Oct 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
577 changes: 234 additions & 343 deletions src/DssSpell.sol

Large diffs are not rendered by default.

89 changes: 88 additions & 1 deletion src/DssSpell.t.base.sol
SidestreamColdMelon marked this conversation as resolved.
Show resolved Hide resolved
SidestreamColdMelon marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,26 @@ interface VoteDelegateFactoryLike {
function create() external returns (address voteDelegate);
}

interface AllocatorVaultLike {
function buffer() external view returns (address);
function draw(uint256 wad) external;
function ilk() external view returns (bytes32);
function jug() external view returns (address);
function roles() external view returns (address);
function usdsJoin() external view returns (address);
function vat() external view returns (address);
function wards(address) external view returns (uint256);
function wipe(uint256 wad) external;
}

interface AllocatorRegistryLike {
function buffers(bytes32) external view returns (address);
}

interface AllocatorRolesLike {
function ilkAdmins(bytes32) external view returns (address);
}

contract DssSpellTestBase is Config, DssTest {
using stdStorage for StdStorage;

Expand Down Expand Up @@ -1906,6 +1926,73 @@ contract DssSpellTestBase is Config, DssTest {
assertEq(litePsm.tout(), type(uint256).max, _concat("checkLitePsmIlkIntegration/mom-halt-invalid-tout-", p.ilk));
}

struct AllocatorIntegrationParams {
SidestreamColdMelon marked this conversation as resolved.
Show resolved Hide resolved
bytes32 ilk;
address pip;
address registry;
address roles;
address buffer;
address vault;
address allocatorProxy;
}

function _checkAllocatorIntegration(AllocatorIntegrationParams memory p) internal {
// Sanity checks
require(AllocatorVaultLike(p.vault).ilk() == p.ilk, "AllocatorInit/vault-ilk-mismatch");
require(AllocatorVaultLike(p.vault).roles() == p.roles, "AllocatorInit/vault-roles-mismatch");
require(AllocatorVaultLike(p.vault).buffer() == p.buffer, "AllocatorInit/vault-buffer-mismatch");
require(AllocatorVaultLike(p.vault).vat() == address(vat), "AllocatorInit/vault-vat-mismatch");
require(AllocatorVaultLike(p.vault).usdsJoin() == address(usdsJoin), "AllocatorInit/vault-usds-join-mismatch");

_vote(address(spell));
_scheduleWaitAndCast(address(spell));
assertTrue(spell.done(), "TestError/spell-not-done");
SidestreamColdMelon marked this conversation as resolved.
Show resolved Hide resolved


(, uint256 rate, uint256 spot,,) = vat.ilks(p.ilk);
assertEq(rate, RAY);
assertEq(spot, 10**18 * RAY * 10**9 / spotter.par());

(address pip,) = spotter.ilks(p.ilk);
assertEq(pip, p.pip);

assertEq(vat.gem(p.ilk, p.vault), 0);
(uint256 ink, uint256 art) = vat.urns(p.ilk, p.vault);
assertEq(ink, 1_000_000_000_000 * WAD);
assertEq(art, 0);

assertEq(AllocatorRegistryLike(p.registry).buffers(p.ilk), p.buffer);
assertEq(address(AllocatorVaultLike(p.vault).jug()), address(jug));

assertEq(usds.allowance(p.buffer, p.vault), type(uint256).max);

assertEq(AllocatorRolesLike(p.roles).ilkAdmins(p.ilk), p.allocatorProxy);

assertEq(AllocatorVaultLike(p.vault).wards(pauseProxy), 0);
assertEq(AllocatorVaultLike(p.vault).wards(p.allocatorProxy), 1);

assertEq(WardsAbstract(p.buffer).wards(pauseProxy), 0);
assertEq(WardsAbstract(p.buffer).wards(p.allocatorProxy), 1);

assertEq(reg.join(p.ilk), address(0));
assertEq(reg.gem(p.ilk), address(0));
assertEq(reg.dec(p.ilk), 0);
assertEq(reg.class(p.ilk), 5);
assertEq(reg.pip(p.ilk), p.pip);
assertEq(reg.xlip(p.ilk), address(0));
assertEq(reg.name(p.ilk), _bytes32ToString(p.ilk));
assertEq(reg.symbol(p.ilk), _bytes32ToString(p.ilk));

// Draw & Wipe from Vault
vm.prank(address(p.allocatorProxy));
AllocatorVaultLike(p.vault).draw(1_000 * WAD);
assertEq(usds.balanceOf(p.buffer), 1_000 * WAD);

vm.prank(address(p.allocatorProxy));
AllocatorVaultLike(p.vault).wipe(1_000 * WAD);
assertEq(usds.balanceOf(p.buffer), 0);
SidestreamColdMelon marked this conversation as resolved.
Show resolved Hide resolved
}

function _to18ConversionFactor(LitePsmLike litePsm) internal view returns (uint256) {
return litePsm.to18ConversionFactor();
}
Expand Down Expand Up @@ -2341,7 +2428,7 @@ contract DssSpellTestBase is Config, DssTest {
if (ward > 0) {
emit log_named_address(" Deployer Address", deployer);
emit log_named_string(" Affected Contract", contractName);
fail("Error: Bad Auth");
SidestreamColdMelon marked this conversation as resolved.
Show resolved Hide resolved
revert("Error: Bad Auth");
}
}
}
Expand Down
Loading
Loading