Skip to content

Commit 8564c61

Browse files
Merge pull request #3 from rainlanguage/2025-08-28-gme-feed
GME, MSTR, SPLG, BRK-B feed
2 parents 041a3a5 + 0306d05 commit 8564c61

File tree

6 files changed

+92
-9
lines changed

6 files changed

+92
-9
lines changed

src/generated/PythWords.pointers.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
pragma solidity =0.8.25;
1111

1212
/// @dev Hash of the known bytecode.
13-
bytes32 constant BYTECODE_HASH = bytes32(0x76761320ccc49a4455512ee152bb242a0b5f5832c6756524129e42ce6d521388);
13+
bytes32 constant BYTECODE_HASH = bytes32(0xc2563d7f113f4586c661be35de1861e2a415f818178ecc8d568dd03a46eb9d92);
1414

1515
/// @dev The hash of the meta that describes the contract.
1616
bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0xe7bb5842b2cf1d25681a9885109fbf8943495bcebb9ec049bc3790e5db57fa80);

src/lib/pyth/LibPyth.sol

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,38 +24,69 @@ library LibPyth {
2424
/// Google.
2525
bytes32 constant PRICE_FEED_ID_EQUITY_US_GOOG_USD =
2626
0xe65ff435be42630439c96396653a342829e877e2aafaeaf1a10d0ee5fd2cf3f2;
27+
// slither-disable-next-line too-many-digits
2728
uint256 constant PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_GOOG_USD =
2829
0x924571756974792e55532e474f4f472f55534400000000000000000000000000;
2930
/// Amazon.
3031
bytes32 constant PRICE_FEED_ID_EQUITY_US_AMZN_USD =
3132
0xb5d0e0fa58a1f8b81498ae670ce93c872d14434b72c364885d4fa1b257cbb07a;
33+
// slither-disable-next-line too-many-digits
3234
uint256 constant PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_AMZN_USD =
3335
0x924571756974792e55532e414d5a4e2f55534400000000000000000000000000;
3436
/// Apple.
3537
bytes32 constant PRICE_FEED_ID_EQUITY_US_AAPL_USD =
3638
0x49f6b65cb1de6b10eaf75e7c03ca029c306d0357e91b5311b175084a5ad55688;
39+
// slither-disable-next-line too-many-digits
3740
uint256 constant PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_AAPL_USD =
3841
0x924571756974792e55532e4141504c2f55534400000000000000000000000000;
3942
/// Microsoft.
4043
bytes32 constant PRICE_FEED_ID_EQUITY_US_MSFT_USD =
4144
0xd0ca23c1cc005e004ccf1db5bf76aeb6a49218f43dac3d4b275e92de12ded4d1;
45+
// slither-disable-next-line too-many-digits
4246
uint256 constant PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_MSFT_USD =
4347
0x924571756974792e55532e4d5346542f55534400000000000000000000000000;
4448
/// Tesla.
4549
bytes32 constant PRICE_FEED_ID_EQUITY_US_TSLA_USD =
4650
0x16dad506d7db8da01c87581c87ca897a012a153557d4d578c3b9c9e1bc0632f1;
51+
// slither-disable-next-line too-many-digits
4752
uint256 constant PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_TSLA_USD =
4853
0x924571756974792e55532e54534c412f55534400000000000000000000000000;
4954
/// Nvidia.
5055
bytes32 constant PRICE_FEED_ID_EQUITY_US_NVDA_USD =
5156
0xb1073854ed24cbc755dc527418f52b7d271f6cc967bbf8d8129112b18860a593;
57+
// slither-disable-next-line too-many-digits
5258
uint256 constant PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_NVDA_USD =
5359
0x924571756974792e55532e4e5644412f55534400000000000000000000000000;
5460
/// Meta Platforms (Facebook).
5561
bytes32 constant PRICE_FEED_ID_EQUITY_US_META_USD =
5662
0x78a3e3b8e676a8f73c439f5d749737034b139bbbe899ba5775216fba596607fe;
63+
// slither-disable-next-line too-many-digits
5764
uint256 constant PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_META_USD =
5865
0x924571756974792e55532e4d4554412f55534400000000000000000000000000;
66+
/// Gamestop
67+
bytes32 constant PRICE_FEED_ID_EQUITY_US_GME_USD =
68+
0x6f9cd89ef1b7fd39f667101a91ad578b6c6ace4579d5f7f285a4b06aa4504be6;
69+
// slither-disable-next-line too-many-digits
70+
uint256 constant PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_GME_USD =
71+
0x914571756974792e55532e474d452f5553440000000000000000000000000000;
72+
/// MicroStrategy (MSTR)
73+
bytes32 constant PRICE_FEED_ID_EQUITY_US_MSTR_USD =
74+
0xe1e80251e5f5184f2195008382538e847fafc36f751896889dd3d1b1f6111f09;
75+
// slither-disable-next-line too-many-digits
76+
uint256 constant PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_MSTR_USD =
77+
0x924571756974792e55532e4d5354522f55534400000000000000000000000000;
78+
/// Berkshire Hathaway Class B (BRK-B)
79+
bytes32 constant PRICE_FEED_ID_EQUITY_US_BRK_B_USD =
80+
0xe21c688b7fc65b4606a50f3635f466f6986db129bf16979875d160f9c508e8c7;
81+
// slither-disable-next-line too-many-digits
82+
uint256 constant PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_BRK_B_USD =
83+
0x934571756974792e55532e42524b2d422f555344000000000000000000000000;
84+
/// SPDR Portfolio S&P 500 ETF (SPLG)
85+
bytes32 constant PRICE_FEED_ID_EQUITY_US_SPLG_USD =
86+
0x4dfbf28d72ab41a878afcd4c6d5e9593dca7cf65a0da739cbad9b7414004f82d;
87+
// slither-disable-next-line too-many-digits
88+
uint256 constant PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_SPLG_USD =
89+
0x924571756974792e55532e53504c472f55534400000000000000000000000000;
5990

6091
/// TODO replace with O(1) lookup table.
6192
function getPriceFeedContract(uint256 chainId) internal pure returns (IPyth) {
@@ -85,6 +116,14 @@ library LibPyth {
85116
return PRICE_FEED_ID_EQUITY_US_NVDA_USD;
86117
} else if (feedSymbol == PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_META_USD) {
87118
return PRICE_FEED_ID_EQUITY_US_META_USD;
119+
} else if (feedSymbol == PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_GME_USD) {
120+
return PRICE_FEED_ID_EQUITY_US_GME_USD;
121+
} else if (feedSymbol == PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_MSTR_USD) {
122+
return PRICE_FEED_ID_EQUITY_US_MSTR_USD;
123+
} else if (feedSymbol == PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_BRK_B_USD) {
124+
return PRICE_FEED_ID_EQUITY_US_BRK_B_USD;
125+
} else if (feedSymbol == PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_SPLG_USD) {
126+
return PRICE_FEED_ID_EQUITY_US_SPLG_USD;
88127
} else {
89128
revert UnsupportedFeedSymbol();
90129
}

test/lib/LibFork.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ string constant FORK_RPC_URL_ARBITRUM = "https://arbitrum.gateway.tenderly.co";
66
string constant FORK_RPC_URL_BASE = "https://base.gateway.tenderly.co";
77

88
uint256 constant FORK_BLOCK_ARBITRUM = 345270769;
9-
uint256 constant FORK_BLOCK_BASE = 31309429;
9+
uint256 constant FORK_BLOCK_BASE = 36353737;

test/src/lib/pyth/LibPyth.constants.t.sol

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,21 @@ contract LibPythConstantsTest is Test {
4141
LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_META_USD,
4242
IntOrAString.unwrap(LibIntOrAString.fromString2("Equity.US.META/USD"))
4343
);
44+
assertEq(
45+
LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_GME_USD,
46+
IntOrAString.unwrap(LibIntOrAString.fromString2("Equity.US.GME/USD"))
47+
);
48+
assertEq(
49+
LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_MSTR_USD,
50+
IntOrAString.unwrap(LibIntOrAString.fromString2("Equity.US.MSTR/USD"))
51+
);
52+
assertEq(
53+
LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_BRK_B_USD,
54+
IntOrAString.unwrap(LibIntOrAString.fromString2("Equity.US.BRK-B/USD"))
55+
);
56+
assertEq(
57+
LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_SPLG_USD,
58+
IntOrAString.unwrap(LibIntOrAString.fromString2("Equity.US.SPLG/USD"))
59+
);
4460
}
4561
}

test/src/lib/pyth/LibPyth.getPriceFeedId.t.sol

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ contract LibPythGetPriceFeedIdTest is Test {
4141
LibPyth.PRICE_FEED_ID_EQUITY_US_META_USD,
4242
LibPyth.getPriceFeedId(LibIntOrAString.fromString2("Equity.US.META/USD"))
4343
);
44+
assertEq(
45+
LibPyth.PRICE_FEED_ID_EQUITY_US_GME_USD,
46+
LibPyth.getPriceFeedId(LibIntOrAString.fromString2("Equity.US.GME/USD"))
47+
);
48+
assertEq(
49+
LibPyth.PRICE_FEED_ID_EQUITY_US_MSTR_USD,
50+
LibPyth.getPriceFeedId(LibIntOrAString.fromString2("Equity.US.MSTR/USD"))
51+
);
52+
assertEq(
53+
LibPyth.PRICE_FEED_ID_EQUITY_US_BRK_B_USD,
54+
LibPyth.getPriceFeedId(LibIntOrAString.fromString2("Equity.US.BRK-B/USD"))
55+
);
56+
assertEq(
57+
LibPyth.PRICE_FEED_ID_EQUITY_US_SPLG_USD,
58+
LibPyth.getPriceFeedId(LibIntOrAString.fromString2("Equity.US.SPLG/USD"))
59+
);
4460
}
4561

4662
function testPriceFeedIdUnknownMappings(IntOrAString symbol) external {
@@ -52,6 +68,10 @@ contract LibPythGetPriceFeedIdTest is Test {
5268
&& IntOrAString.unwrap(symbol) != IntOrAString.unwrap(LibIntOrAString.fromString2("Equity.US.TSLA/USD"))
5369
&& IntOrAString.unwrap(symbol) != IntOrAString.unwrap(LibIntOrAString.fromString2("Equity.US.NVDA/USD"))
5470
&& IntOrAString.unwrap(symbol) != IntOrAString.unwrap(LibIntOrAString.fromString2("Equity.US.META/USD"))
71+
&& IntOrAString.unwrap(symbol) != IntOrAString.unwrap(LibIntOrAString.fromString2("Equity.US.GME/USD"))
72+
&& IntOrAString.unwrap(symbol) != IntOrAString.unwrap(LibIntOrAString.fromString2("Equity.US.MSTR/USD"))
73+
&& IntOrAString.unwrap(symbol) != IntOrAString.unwrap(LibIntOrAString.fromString2("Equity.US.BRK-B/USD"))
74+
&& IntOrAString.unwrap(symbol) != IntOrAString.unwrap(LibIntOrAString.fromString2("Equity.US.SPLG/USD"))
5575
);
5676
vm.expectRevert(UnsupportedFeedSymbol.selector);
5777
this.getPriceFeedIdExternal(symbol);

test/src/lib/pyth/LibPyth.getPriceNoOlderThan.t.sol

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,21 @@ contract LibPythGetPriceNoOlderThanTest is Test {
2727
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.TSLA/USD"), 300 hours, 360.02978e18);
2828
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.NVDA/USD"), 1000 hours, 104.5623e18);
2929
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.META/USD"), 8000 hours, 448.73e18);
30+
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.GME/USD"), 8000 hours, 29.3177e18);
31+
}
32+
33+
function testPriceNoOlderThanBase() external {
3034
vm.createSelectFork(FORK_RPC_URL_BASE, FORK_BLOCK_BASE);
31-
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.GOOG/USD"), 72 hours, 174.93179e18);
32-
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.AMZN/USD"), 500 hours, 207.372e18);
33-
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.AAPL/USD"), 72 hours, 205.12e18);
34-
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.MSFT/USD"), 300 hours, 458.35309e18);
35-
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.TSLA/USD"), 72 hours, 301.47341e18);
36-
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.NVDA/USD"), 72 hours, 141.66994e18);
37-
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.META/USD"), 72 hours, 693.349e18);
35+
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.GOOG/USD"), 24 hours, 246.29352e18);
36+
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.AMZN/USD"), 24 hours, 222.43512e18);
37+
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.AAPL/USD"), 24 hours, 257.33026e18);
38+
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.MSFT/USD"), 24 hours, 515.64431e18);
39+
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.TSLA/USD"), 24 hours, 436.03414e18);
40+
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.NVDA/USD"), 24 hours, 188.92e18);
41+
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.META/USD"), 24 hours, 727.0145e18);
42+
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.GME/USD"), 24 hours, 27.24202e18);
43+
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.MSTR/USD"), 24 hours, 352.34642e18);
44+
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.BRK-B/USD"), 24 hours, 496.12003e18);
45+
checkPriceNoOlderThan(LibIntOrAString.fromString2("Equity.US.SPLG/USD"), 24 hours, 78.71367e18);
3846
}
3947
}

0 commit comments

Comments
 (0)