Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c404c1c
initial commit
escottalexander Aug 26, 2025
5eeca9f
Initial commit of base challenge template for extensions
rin-st Nov 1, 2024
fb628b1
fill template
escottalexander Aug 21, 2025
a46360e
update social card image name
escottalexander Aug 21, 2025
c530602
second stage
escottalexander Aug 22, 2025
c5fea2f
formatting changes
escottalexander Aug 22, 2025
8c68735
add package.jsons
escottalexander Aug 22, 2025
8350909
add sort function without OZ dep
escottalexander Aug 22, 2025
e32446b
add Hardhat configuration and formatting updates
escottalexander Aug 22, 2025
f95d79c
add children to monitor tx
escottalexander Aug 23, 2025
2c1bf2c
update oracle-bot config values, enhance tooltip styling, and rename …
escottalexander Aug 26, 2025
70a9257
Refactor deployment scripts to conditionally execute on localhost, en…
escottalexander Aug 26, 2025
a629333
address feedback
AzimovS Sep 11, 2025
c99eb5d
docs: add natspecs
AzimovS Sep 11, 2025
fc6dc89
refactor: reorganize StakingOracle functions
AzimovS Sep 13, 2025
951e599
update readme and stale data window time
AzimovS Sep 13, 2025
61b9e22
update checkpoint 1
AzimovS Sep 13, 2025
a1e2361
update checkpoint 2
AzimovS Sep 13, 2025
b6c2cac
fix: deploy scripts
AzimovS Sep 14, 2025
aefb9c3
feat: add tests for OO checkpoints
AzimovS Sep 15, 2025
5567499
add tests for whitelist and staking oracles
AzimovS Sep 15, 2025
0531169
update readme
AzimovS Sep 15, 2025
9afb407
fix: deploy script for stakingOracle and display balance of ORA
AzimovS Sep 15, 2025
8443e2e
minor fix in readme
AzimovS Sep 15, 2025
47f64ce
minor readme fixes
AzimovS Sep 18, 2025
0771f0e
update readme wording and structure in a few places
escottalexander Sep 19, 2025
adc8213
address quick feedback
escottalexander Sep 27, 2025
eba41e4
change staking challenge tobe more interactive, have slashing based o…
escottalexander Oct 31, 2025
0123bc9
refactor: remove unused args and providers from ScaffoldEthAppWithPro…
escottalexander Oct 31, 2025
b3788d4
Replace placeholder images with actual URLs
escottalexander Oct 31, 2025
37b039a
update images in args.mjs readme file
escottalexander Oct 31, 2025
be60459
Empty contract functions
escottalexander Oct 31, 2025
ad99f37
remove quotes from images in markdown
escottalexander Oct 31, 2025
2ca644f
warnings about first deploy
escottalexander Oct 31, 2025
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
2,045 changes: 2,041 additions & 4 deletions README.md

Large diffs are not rendered by default.

2,021 changes: 1,993 additions & 28 deletions extension/README.md.args.mjs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions extension/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"scripts": {
"simulate:whitelist": "yarn workspace @se-2/hardhat simulate:whitelist",
"simulate:staking": "yarn workspace @se-2/hardhat simulate:staking",
"simulate:optimistic": "yarn workspace @se-2/hardhat simulate:optimistic"
}
}
73 changes: 73 additions & 0 deletions extension/packages/hardhat/contracts/00_Whitelist/SimpleOracle.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

contract SimpleOracle {
/////////////////
/// Errors //////
/////////////////

error OnlyOwner();

//////////////////////
/// State Variables //
//////////////////////

uint256 public price;
uint256 public timestamp;
address public owner;

////////////////
/// Events /////
////////////////

event PriceUpdated(uint256 newPrice);

///////////////////
/// Constructor ///
///////////////////

constructor(address _owner) {
owner = _owner;
}

///////////////////
/// Modifiers /////
///////////////////

/**
* @notice Modifier to restrict function access to the contract owner
* @dev Currently disabled to make it easy for you to impersonate the owner
*/
modifier onlyOwner() {
// Intentionally removing the owner requirement to make it easy for you to impersonate the owner
// if (msg.sender != owner) revert OnlyOwner();
_;
}

///////////////////
/// Functions /////
///////////////////

/**
* @notice Updates the oracle price with a new value (only contract owner)
* @dev Sets the price and records the current block timestamp for freshness tracking.
* Emits PriceUpdated event upon successful update.
* @param _newPrice The new price value to set for this oracle
*/
function setPrice(uint256 _newPrice) public onlyOwner {
price = _newPrice;
timestamp = block.timestamp;
emit PriceUpdated(_newPrice);
}

/**
* @notice Returns the current price and its timestamp
* @dev Provides both the stored price value and when it was last updated.
* Used by aggregators to determine price freshness.
* @return price The current price stored in this oracle
* @return timestamp The block timestamp when the price was last updated
*/
function getPrice() public view returns (uint256, uint256) {
return (price, timestamp);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

import "./SimpleOracle.sol";
import { StatisticsUtils } from "../utils/StatisticsUtils.sol";

contract WhitelistOracle {
using StatisticsUtils for uint256[];

/////////////////
/// Errors //////
/////////////////

error OnlyOwner();
error IndexOutOfBounds();
error NoOraclesAvailable();

//////////////////////
/// State Variables //
//////////////////////

address public owner;
SimpleOracle[] public oracles;
uint256 public constant STALE_DATA_WINDOW = 24 seconds;

////////////////
/// Events /////
////////////////

event OracleAdded(address oracleAddress, address oracleOwner);
event OracleRemoved(address oracleAddress);

///////////////////
/// Modifiers /////
///////////////////

/**
* @notice Modifier to restrict function access to the contract owner
* @dev Currently disabled to make it easy for you to impersonate the owner
*/
modifier onlyOwner() {
// if (msg.sender != owner) revert OnlyOwner();
_;
}

///////////////////
/// Constructor ///
///////////////////

constructor() {
owner = msg.sender;
}

///////////////////
/// Functions /////
///////////////////

/**
* @notice Adds a new oracle to the whitelist by deploying a SimpleOracle contract (only contract owner)
* @dev Creates a new SimpleOracle instance and adds it to the oracles array.
* @param _owner The address that will own the newly created oracle and can update its price
*/
function addOracle(address _owner) public onlyOwner {}

/**
* @notice Removes an oracle from the whitelist by its array index (only contract owner)
* @dev Uses swap-and-pop pattern for gas-efficient removal. Order is not preserved.
* Reverts with IndexOutOfBounds, if the provided index is >= oracles.length.
* @param index The index of the oracle to remove from the oracles array
*/
function removeOracle(uint256 index) public onlyOwner {}

/**
* @notice Returns the aggregated price from all active oracles using median calculation
* @dev Filters oracles with timestamps older than STALE_DATA_WINDOW, then calculates median
* of remaining valid prices. Uses StatisticsUtils for sorting and median calculation.
* @return The median price from all active oracles
*/
function getPrice() public view returns (uint256) {}

/**
* @notice Returns the addresses of all oracles that have updated their price within the last STALE_DATA_WINDOW
* @dev Iterates through all oracles and filters those with recent timestamps (within STALE_DATA_WINDOW).
* Uses a temporary array to collect active nodes, then creates a right-sized return array
* for gas optimization.
* @return An array of addresses representing the currently active oracle contracts
*/
function getActiveOracleNodes() public view returns (address[] memory) {}
}
20 changes: 20 additions & 0 deletions extension/packages/hardhat/contracts/01_Staking/OracleToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract ORA is ERC20, Ownable {
constructor() ERC20("Oracle Token", "ORA") Ownable(msg.sender) {
// Mint initial supply to the contract deployer
_mint(msg.sender, 1000000 * 10 ** decimals());
}

function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}

function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
}
Loading