Skip to content

Commit

Permalink
Added all evm price feeds and context. Mock all getPrice calls
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandro-immunefi committed Feb 7, 2024
1 parent 873624e commit eed32bf
Show file tree
Hide file tree
Showing 3 changed files with 505 additions and 21 deletions.
10 changes: 4 additions & 6 deletions src/log/Log.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ abstract contract Log {
}

// Enum defining different phases for logging
enum LogPhase
// Default phase
{
enum LogPhase {
// Default phase
DEFAULT,
// Log messages from the "Initiate Attack" phase
INITIALIZE_ATTACK,
Expand All @@ -35,9 +34,8 @@ abstract contract Log {
}

// Enum defining different types of logs
enum LogType
// Log everything
{
enum LogType {
// Log everything
ALL,
// Log messages from the "Initiate Attack" phase
INITIALIZE_ATTACK,
Expand Down
7 changes: 2 additions & 5 deletions src/oracle/examples/MockOracleExample.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ import "../lib/MockPyth.sol";
import "../lib/MockChainLink.sol";

contract MockOracleExample {
// TODO: provide list of all referencable price feeds
bytes32 pid = 0x2f95862b045670cd22bee3114c39763a4a08beeb663b145d283c31d7d1101c4f; // BNB/USD

function initiateAttack() external {
//1. PYTH ORACLE
MockPyth.mockOracleData(pid, 1337);
MockPyth.mockOracleData(PriceFeeds.Crypto_BNB_USD, 1337);
//2. CHAINLINK ORACLE
MockChainLink.mockOracleData(EthereumTokens.LINK, Fiat.USD, 1337); // LINK/USD

Expand All @@ -23,7 +20,7 @@ contract MockOracleExample {
function _executeAttack() internal {
//1. PYTH ORACLE
PythUpgradable pyth = PythUpgradable(0x4305FB66699C3B2702D4d05CF36551390A4c69C6);
PythUpgradable.Price memory p = pyth.getPriceUnsafe(pid);
PythUpgradable.Price memory p = pyth.getPriceUnsafe(PriceFeeds.Crypto_BNB_USD);
console.logInt(p.price);
_completeAttack();

Expand Down
Loading

0 comments on commit eed32bf

Please sign in to comment.