Skip to content

Commit 7fa3336

Browse files
Merge pull request #62 from escottalexander/readme
Readme
2 parents 5bb82e7 + 4e9c50c commit 7fa3336

File tree

12 files changed

+1134
-46
lines changed

12 files changed

+1134
-46
lines changed

README.md

Lines changed: 1115 additions & 5 deletions
Large diffs are not rendered by default.

packages/hardhat/contracts/SimpleOracle.sol renamed to packages/hardhat/contracts/00_Whitelist/SimpleOracle.sol

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ contract SimpleOracle {
99

1010
constructor() {}
1111

12-
// Note: In a real oracle implementation, this function would typically have
13-
// an onlyOwner modifier to restrict who can update prices. We've removed
14-
// it here to make prices easily editable in the frontend.
15-
function setPrice(uint256 _newPrice) public {
12+
modifier onlyOwner() {
13+
// Intentionally removing the owner requirement to make it easy for you to impersonate the owner
14+
// require(msg.sender == owner, "Not the owner");
15+
_;
16+
}
17+
18+
function setPrice(uint256 _newPrice) public onlyOwner {
1619
price = _newPrice;
1720
timestamp = block.timestamp;
1821
emit PriceUpdated(_newPrice);

packages/hardhat/contracts/WhitelistOracle.sol renamed to packages/hardhat/contracts/00_Whitelist/WhitelistOracle.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ contract WhitelistOracle {
1616
}
1717

1818
modifier onlyOwner() {
19-
require(msg.sender == owner, "Not the owner");
19+
// Intentionally removing the owner requirement to make it easy for you to impersonate the owner
20+
// require(msg.sender == owner, "Not the owner");
2021
_;
2122
}
2223

packages/hardhat/contracts/StakingOracle.sol renamed to packages/hardhat/contracts/01_Staking/StakingOracle.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,6 @@ contract StakingOracle {
185185
function getNodeAddresses() public view returns (address[] memory) {
186186
return nodeAddresses;
187187
}
188+
189+
// Notably missing a way to unstake and exit your node but not needed for the challenge
188190
}

packages/hardhat/contracts/Optimistic/OptimisticOracle.sol renamed to packages/hardhat/contracts/02_Optimistic/OptimisticOracle.sol

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ contract OptimisticOracle {
7171
emit DeciderUpdated(oldDecider, _decider);
7272
}
7373

74+
/**
75+
* @notice Get the assertion details.
76+
*/
77+
function getAssertion(uint256 assertionId) external view returns (EventAssertion memory) {
78+
return assertions[assertionId];
79+
}
80+
7481
/**
7582
* @notice Assert that an event will have a true/false outcome.
7683
* @dev The `description` is used to identify the event (e.g. "Did X happen by time Y?")
@@ -281,11 +288,4 @@ contract OptimisticOracle {
281288
return a.resolvedOutcome;
282289
}
283290
}
284-
285-
/**
286-
* @notice Get the assertion details.
287-
*/
288-
function getAssertion(uint256 assertionId) external view returns (EventAssertion memory) {
289-
return assertions[assertionId];
290-
}
291291
}

packages/hardhat/deploy/00_deploy_whitelist.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ const deployWhitelistOracleContracts: DeployFunction = async function (hre: Hard
1111
const { deployer } = await hre.getNamedAccounts();
1212
const { deploy } = hre.deployments;
1313
const { viem } = hre;
14-
// Set your own address here
15-
const whitelistContractNewOwner = deployer;
1614

1715
const publicClient = await viem.getPublicClient();
1816

@@ -107,17 +105,6 @@ const deployWhitelistOracleContracts: DeployFunction = async function (hre: Hard
107105
});
108106
console.log(`Initial median price: ${medianPrice.toString()}`);
109107

110-
if (deployer !== whitelistContractNewOwner) {
111-
console.log("Transferring ownership of WhitelistOracle");
112-
await deployerAccount.writeContract({
113-
address: whitelistOracleAddress,
114-
abi: whitelistOracleAbi,
115-
functionName: "transferOwnership",
116-
args: [whitelistContractNewOwner],
117-
});
118-
console.log("Ownership transferred successfully!");
119-
}
120-
121108
console.log("All oracle contracts deployed and configured successfully!");
122109
};
123110

File renamed without changes.

0 commit comments

Comments
 (0)