-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add mock oracle #11
Conversation
Signed-off-by: Pablo Maldonado <pablo@umaproject.org>
|
||
// This function is part of the AccessControlledOffchainAggregator interface. It is used to | ||
// update the new price and look like a transmit function from a real Chainlink Aggregator | ||
function transmit( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the transmit
function from the AccessControlledOffchainAggregator
so we don't need a second mock oracle.
By setting aggregator = address(this)
in the constructor we mock the aggregator as well. This is useful for monitoring transmit calls in the backrunner mempool technique.
constructor(uint8 _decimals, int256 _initialAnswer) { | ||
decimals = _decimals; | ||
updateAnswer(_initialAnswer); | ||
aggregator = address(this); // For simplicity, we set the aggregator address to the contract address |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use this mock contract as the aggregator where new prices are pushed
Signed-off-by: Pablo Maldonado <pablo@umaproject.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good
contract HoneyPotDeploymentScript is Script { | ||
function run() external { | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
address chainlink = vm.envAddress("SOURCE_ADDRESS"); | ||
address chainlink = vm.envOr("SOURCE_ADDRESS", address(0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can the app run with address 0? if not just throw if not provided
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not provided it deploys a mock oracle
Changes proposed in this PR: