Skip to content

Commit

Permalink
Merge pull request #39 from makerdao/sc-1458-gnousd
Browse files Browse the repository at this point in the history
Adds GNOUSD
  • Loading branch information
jar-o authored Dec 13, 2022
2 parents 34344d3 + 8e493ec commit 3be06fc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
15 changes: 4 additions & 11 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,10 @@ jobs:
with:
submodules: recursive

- name: Install nix 2.3.6
uses: cachix/install-nix-action@v13
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
install_url: https://releases.nixos.org/nix/nix-2.3.6/install
nix_path: nixpkgs=channel:nixos-unstable

- name: Use maker and dapp cachix
uses: cachix/cachix-action@v10
with:
name: maker
extraPullNames: dapp
version: nightly

- name: Run tests
run: nix-shell --pure --argstr url ${{ secrets.ETH_RPC_URL }} --run 'dapp test -v --rpc'
run: ETH_RPC_URL=${{ secrets.ETH_RPC_URL }} ./scripts/test-forge.sh
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Optimized Smart Contract to Poke (`poke`).

For Now, Hard Coded Addresses and Sequences. Easy for TechOps to Run.

MegaPoker current Mainnet Address: [0x450f6f025ad017f345cd17407ee22d90e5f87441](https://etherscan.io/address/0x450f6f025ad017f345cd17407ee22d90e5f87441#code)
MegaPoker current Mainnet Address: [0x50B19f34595bfF59977e3058AC0ff7f729Fdc67a](https://etherscan.io/address/0x50B19f34595bfF59977e3058AC0ff7f729Fdc67a#code)

# OmegaPoker

Expand Down
3 changes: 3 additions & 0 deletions src/MegaPoker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ contract PokingAddresses {
address constant guniv3daiusdc2 = 0xcCBa43231aC6eceBd1278B90c3a44711a00F4e93;
address constant spotter = 0x65C79fcB50Ca1594B025960e539eD7A9a6D434A3;
address constant reth = 0xeE7F0b350aA119b3d05DC733a4621a81972f7D47;
address constant gno = 0xd800ca44fFABecd159c7889c3bf64a217361AEc8;
}

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


// poke(bytes32) = 0x1504460f
Expand All @@ -75,6 +77,7 @@ contract MegaPoker is PokingAddresses {
(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")));
(ok,) = spotter.call(abi.encodeWithSelector(0x1504460f, bytes32("GNO-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 @@ -179,6 +179,7 @@ contract MegaPokerTest is DSTest, PokingAddresses {
hevm.store(guniv3daiusdc1, bytes32(uint256(4)), hackedValue);
hevm.store(guniv3daiusdc2, bytes32(uint256(4)), hackedValue);
hevm.store(reth, bytes32(uint256(4)), hackedValue);
hevm.store(gno, bytes32(uint256(4)), hackedValue);

// Whitelisting tester address
hevm.store(eth, keccak256(abi.encode(address(this), uint256(5))), bytes32(uint256(1)));
Expand All @@ -191,6 +192,7 @@ contract MegaPokerTest is DSTest, PokingAddresses {
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(gno, 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 @@ -209,6 +211,7 @@ contract MegaPokerTest is DSTest, PokingAddresses {
assertTrue(OsmLike(wsteth).read() != hackedValue);
assertTrue(OsmLike(crvv1ethsteth).read() != hackedValue);
assertTrue(OsmLike(reth).read() != hackedValue);
assertTrue(OsmLike(gno).read() != hackedValue);

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

// Daily OSM's are not updated after one hour
assertTrue(OsmLike(guniv3daiusdc1).read() != hackedValue);
Expand Down Expand Up @@ -288,6 +292,9 @@ contract MegaPokerTest is DSTest, PokingAddresses {
(, mat) = SpotLike(spotter).ilks("RETH-A");
(,, spot,,) = VatLike(vat).ilks("RETH-A");
assertEq(spot, _rdiv(value, mat));
(, mat) = SpotLike(spotter).ilks("GNO-A");
(,, spot,,) = VatLike(vat).ilks("GNO-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 3be06fc

Please sign in to comment.