Skip to content

Commit

Permalink
Merge pull request #37 from makerdao/sc-1326-add-rethusd-poke
Browse files Browse the repository at this point in the history
add RETHUSD OSM to poke()
  • Loading branch information
jar-o authored Nov 16, 2022
2 parents 6d65f2e + 22ea436 commit 1bcc782
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e

[[ "$ETH_RPC_URL" && "$(seth chain)" == "ethlive" ]] || { echo "Please set a mainnet ETH_RPC_URL"; exit 1; }

DAPP_BUILD_OPTIMIZE=1 DAPP_BUILD_OPTIMIZE_RUNS=1000 dapp --use solc:0.6.12 test --rpc-url="$ETH_RPC_URL" -v
DAPP_BUILD_OPTIMIZE=1 DAPP_BUILD_OPTIMIZE_RUNS=1000 dapp --use solc:0.6.12 test --rpc-url="$ETH_RPC_URL" -vvv
3 changes: 3 additions & 0 deletions src/MegaPoker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ contract PokingAddresses {
address constant guniv3daiusdc1 = 0x7F6d78CC0040c87943a0e0c140De3F77a273bd58;
address constant guniv3daiusdc2 = 0xcCBa43231aC6eceBd1278B90c3a44711a00F4e93;
address constant spotter = 0x65C79fcB50Ca1594B025960e539eD7A9a6D434A3;
address constant reth = 0xeE7F0b350aA119b3d05DC733a4621a81972f7D47;
}

contract MegaPoker is PokingAddresses {
Expand All @@ -53,6 +54,7 @@ contract MegaPoker is PokingAddresses {
(ok,) = matic.call(abi.encodeWithSelector(0x18178358));
(ok,) = wsteth.call(abi.encodeWithSelector(0x18178358));
(ok,) = crvv1ethsteth.call(abi.encodeWithSelector(0x18178358));
(ok,) = reth.call(abi.encodeWithSelector(0x18178358));


// poke(bytes32) = 0x1504460f
Expand All @@ -72,6 +74,7 @@ contract MegaPoker is PokingAddresses {
(ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, bytes32("CRVV1ETHSTETH-A")));
(ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, bytes32("WBTC-B")));
(ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, bytes32("WBTC-C")));
(ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, bytes32("RETH-A")));


// Daily pokes
Expand Down
7 changes: 7 additions & 0 deletions src/MegaPoker.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ contract MegaPokerTest is DSTest, PokingAddresses {
hevm.store(crvv1ethsteth, bytes32(uint256(4)), hackedValue);
hevm.store(guniv3daiusdc1, bytes32(uint256(4)), hackedValue);
hevm.store(guniv3daiusdc2, bytes32(uint256(4)), hackedValue);
hevm.store(reth, bytes32(uint256(4)), hackedValue);

// Whitelisting tester address
hevm.store(eth, keccak256(abi.encode(address(this), uint256(5))), bytes32(uint256(1)));
Expand All @@ -189,6 +190,7 @@ contract MegaPokerTest is DSTest, PokingAddresses {
hevm.store(univ2daiusdc, keccak256(abi.encode(address(this), uint256(2))), bytes32(uint256(1)));
hevm.store(matic, keccak256(abi.encode(address(this), uint256(5))), bytes32(uint256(1)));
hevm.store(wsteth, keccak256(abi.encode(address(this), uint256(5))), bytes32(uint256(1)));
hevm.store(reth, keccak256(abi.encode(address(this), uint256(5))), bytes32(uint256(1)));
hevm.store(crvv1ethsteth, keccak256(abi.encode(address(this), uint256(2))), bytes32(uint256(1)));
hevm.store(guniv3daiusdc1, keccak256(abi.encode(address(this), uint256(2))), bytes32(uint256(1)));
hevm.store(guniv3daiusdc2, keccak256(abi.encode(address(this), uint256(2))), bytes32(uint256(1)));
Expand All @@ -206,6 +208,7 @@ contract MegaPokerTest is DSTest, PokingAddresses {
assertTrue(OsmLike(matic).read() != hackedValue);
assertTrue(OsmLike(wsteth).read() != hackedValue);
assertTrue(OsmLike(crvv1ethsteth).read() != hackedValue);
assertTrue(OsmLike(reth).read() != hackedValue);

assertTrue(OsmLike(guniv3daiusdc1).read() != hackedValue);
assertTrue(OsmLike(guniv3daiusdc2).read() != hackedValue);
Expand All @@ -223,6 +226,7 @@ contract MegaPokerTest is DSTest, PokingAddresses {
assertEq(OsmLike(matic).read(), hackedValue);
assertEq(OsmLike(wsteth).read(), hackedValue);
assertEq(OsmLike(crvv1ethsteth).read(), hackedValue);
assertEq(OsmLike(reth).read(), hackedValue);

// Daily OSM's are not updated after one hour
assertTrue(OsmLike(guniv3daiusdc1).read() != hackedValue);
Expand Down Expand Up @@ -281,6 +285,9 @@ contract MegaPokerTest is DSTest, PokingAddresses {
(, mat) = SpotLike(spotter).ilks("WBTC-C");
(,, spot,,) = VatLike(vat).ilks("WBTC-C");
assertEq(spot, _rdiv(value, mat));
(, mat) = SpotLike(spotter).ilks("RETH-A");
(,, spot,,) = VatLike(vat).ilks("RETH-A");
assertEq(spot, _rdiv(value, mat));

// These collateral types should not be updated after 1 hour
(, mat) = SpotLike(spotter).ilks("GUNIV3DAIUSDC1-A");
Expand Down

0 comments on commit 1bcc782

Please sign in to comment.