-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add interface, base and mainnet implementation * add tests for all dsr oracle * add fuzz test with some error bounds * use longer duration and compare binomial to exact * add natspec to interface * update xchain helpers * add gas metering tests * add 1 hour gas tests * add comments about source of conversion rate compute functions * change constant names to be less confusing * add notes about why the value is what it is * started on gnosis * begin gnosis chain dsr oracle * add integration test for mainnet and gnosis * refactor integration tests into separate files * spacing fix * remove maker blurb * use more specific revert * alignment * alignment and slight change to final compare * fix for checking past timestamp reverts; fix formula for linear approx; more explicit casting to uint256 to prevent subtle overflows * remove the zero dsr check * use explicit error vs subtle underflow for timestamps * use explicit error vs subtle underflow for timestamps * optimize the gas on the no elapsed time scenario * tighter boundary condition * align * align * cache one year timestamp * align * rm extra space * add a bunch of sanity checks to updates to minimize damage during an oracle attack * update xchain-helpers * fix tests * add failure case tests * dont use the sanity checks for mainnet oracle * refactoring the structure * forge install: openzeppelin-contracts v5.0.0 * make a generic auth oracle and split out gnosis-specific bridging behaviour to a separate contract * bump forge-std to fix integration tests * add optimism * add assert * store last sent data to assist with keepers * fix timestamp issue * fix ci * remove unused import * add arbitrum * formatting
- Loading branch information
Showing
5 changed files
with
103 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
pragma solidity ^0.8.0; | ||
|
||
import { XChainForwarders } from 'xchain-helpers/XChainForwarders.sol'; | ||
|
||
import { DSROracleForwarderBase } from './DSROracleForwarderBase.sol'; | ||
|
||
contract DSROracleForwarderArbitrumOne is DSROracleForwarderBase { | ||
|
||
constructor(address _pot, address _l2Oracle) DSROracleForwarderBase(_pot, _l2Oracle) { | ||
// Intentionally left blank | ||
} | ||
|
||
function refresh( | ||
uint256 gasLimit, | ||
uint256 maxFeePerGas, | ||
uint256 baseFee | ||
) public payable { | ||
XChainForwarders.sendMessageArbitrumOne( | ||
address(l2Oracle), | ||
_packMessage(), | ||
gasLimit, | ||
maxFeePerGas, | ||
baseFee | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
pragma solidity ^0.8.0; | ||
|
||
import { ArbitrumReceiver } from 'xchain-helpers/ArbitrumReceiver.sol'; | ||
|
||
import { IDSRAuthOracle, IDSROracle } from '../interfaces/IDSRAuthOracle.sol'; | ||
|
||
contract DSROracleReceiverArbitrum is ArbitrumReceiver { | ||
|
||
IDSRAuthOracle public oracle; | ||
|
||
constructor( | ||
address _l1Authority, | ||
IDSRAuthOracle _oracle | ||
) ArbitrumReceiver(_l1Authority) { | ||
oracle = _oracle; | ||
} | ||
|
||
function setPotData(IDSROracle.PotData calldata data) external onlyCrossChainMessage { | ||
oracle.setPotData(data); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
pragma solidity ^0.8.0; | ||
|
||
import { ArbitrumDomain } from "xchain-helpers/testing/ArbitrumDomain.sol"; | ||
|
||
import { DSROracleForwarderArbitrumOne } from "src/forwarders/DSROracleForwarderArbitrumOne.sol"; | ||
import { DSROracleReceiverArbitrum } from "src/receivers/DSROracleReceiverArbitrum.sol"; | ||
|
||
import "./DSROracleXChainIntegrationBase.t.sol"; | ||
|
||
contract DSROracleIntegrationArbitrumTest is DSROracleXChainIntegrationBaseTest { | ||
|
||
DSROracleForwarderArbitrumOne forwarder; | ||
DSROracleReceiverArbitrum receiver; | ||
|
||
function setupDomain() internal override { | ||
remote = new ArbitrumDomain(getChain('arbitrum_one'), mainnet); | ||
|
||
mainnet.selectFork(); | ||
|
||
address expectedReceiver = computeCreateAddress(address(this), 5); | ||
forwarder = new DSROracleForwarderArbitrumOne(address(pot), expectedReceiver); | ||
|
||
remote.selectFork(); | ||
|
||
oracle = new DSRAuthOracle(); | ||
receiver = new DSROracleReceiverArbitrum(address(forwarder), oracle); | ||
|
||
oracle.grantRole(oracle.DATA_PROVIDER_ROLE(), address(receiver)); | ||
|
||
assertEq(address(receiver), expectedReceiver); | ||
} | ||
|
||
function doRefresh() internal override { | ||
forwarder.refresh{value:1 ether}(500_000, 1 gwei, block.basefee + 10 gwei); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters