Skip to content

Commit

Permalink
[SC-467] Update to latest xchain-helpers (#20)
Browse files Browse the repository at this point in the history
* update to latest xchain-helpers and some minor cosmetic refactoring

* update xchain-helpers
  • Loading branch information
hexonaut authored Jul 2, 2024
1 parent a02e592 commit b868f15
Show file tree
Hide file tree
Showing 15 changed files with 98 additions and 315 deletions.
2 changes: 1 addition & 1 deletion lib/xchain-helpers
Submodule xchain-helpers updated 40 files
+ .assets/xchain-helpers.png
+3 −1 .github/workflows/ci.yml
+3 −0 .gitmodules
+18 −1 README.md
+1 −0 lib/openzeppelin-contracts
+0 −33 src/ArbitrumReceiver.sol
+0 −44 src/GnosisReceiver.sol
+0 −38 src/OptimismReceiver.sol
+0 −199 src/XChainForwarders.sol
+52 −0 src/forwarders/AMBForwarder.sol
+60 −0 src/forwarders/ArbitrumForwarder.sol
+57 −0 src/forwarders/CCTPForwarder.sol
+39 −0 src/forwarders/OptimismForwarder.sol
+44 −0 src/receivers/AMBReceiver.sol
+37 −0 src/receivers/ArbitrumReceiver.sol
+45 −0 src/receivers/CCTPReceiver.sol
+38 −0 src/receivers/OptimismReceiver.sol
+0 −163 src/testing/ArbitrumDomain.sol
+15 −0 src/testing/Bridge.sol
+0 −16 src/testing/BridgedDomain.sol
+41 −15 src/testing/Domain.sol
+0 −118 src/testing/GnosisDomain.sol
+0 −116 src/testing/OptimismDomain.sol
+0 −112 src/testing/ZkEVMDomain.sol
+109 −0 src/testing/bridges/AMBBridgeTesting.sol
+182 −0 src/testing/bridges/ArbitrumBridgeTesting.sol
+100 −0 src/testing/bridges/CCTPBridgeTesting.sol
+137 −0 src/testing/bridges/OptimismBridgeTesting.sol
+27 −1 src/testing/utils/RecordedLogs.sol
+102 −0 test/AMBReceiver.t.sol
+50 −77 test/ArbitrumIntegration.t.sol
+67 −0 test/ArbitrumReceiver.t.sol
+98 −0 test/CCTPReceiver.t.sol
+117 −0 test/CircleCCTPIntegration.t.sol
+67 −77 test/GnosisIntegration.t.sol
+110 −8 test/IntegrationBase.t.sol
+54 −77 test/OptimismIntegration.t.sol
+84 −0 test/OptimismReceiver.t.sol
+0 −68 test/ZkEVMIntegration.t.sol
+16 −0 test/mocks/TargetContractMock.sol
26 changes: 13 additions & 13 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { DSROracleForwarderBaseChain } from "src/forwarders/DSROracleForwarder
import { DSROracleForwarderGnosis } from "src/forwarders/DSROracleForwarderGnosis.sol";
import { DSROracleForwarderArbitrumOne } from "src/forwarders/DSROracleForwarderArbitrumOne.sol";

import { DSROracleReceiverOptimism } from "src/receivers/DSROracleReceiverOptimism.sol";
import { DSROracleReceiverGnosis } from "src/receivers/DSROracleReceiverGnosis.sol";
import { DSROracleReceiverArbitrum } from "src/receivers/DSROracleReceiverArbitrum.sol";
import { AMBReceiver } from "xchain-helpers/receivers/AMBReceiver.sol";
import { ArbitrumReceiver } from "xchain-helpers/receivers/ArbitrumReceiver.sol";
import { OptimismReceiver } from "xchain-helpers/receivers/OptimismReceiver.sol";

contract Deploy is Script {

Expand All @@ -41,7 +41,7 @@ contract Deploy is Script {

vm.startBroadcast();
DSRAuthOracle oracle = new DSRAuthOracle();
address receiver = deployReceiver(forwarder, oracle);
address receiver = deployReceiver(forwarder, address(oracle));
require(receiver == expectedReceiver, "receiver mismatch");
DSRBalancerRateProviderAdapter adapter = new DSRBalancerRateProviderAdapter(oracle);

Expand All @@ -63,7 +63,7 @@ contract Deploy is Script {
return address(0);
}

function deployReceiver(address, IDSRAuthOracle) internal virtual returns (address) {
function deployReceiver(address, address) internal virtual returns (address) {
return address(0);
}

Expand All @@ -79,8 +79,8 @@ contract DeployOptimism is Deploy {
return address(new DSROracleForwarderOptimism(MCD_POT, receiver));
}

function deployReceiver(address forwarder, IDSRAuthOracle oracle) internal override returns (address) {
return address(new DSROracleReceiverOptimism(forwarder, oracle));
function deployReceiver(address forwarder, address oracle) internal override returns (address) {
return address(new OptimismReceiver(forwarder, oracle));
}

}
Expand All @@ -95,8 +95,8 @@ contract DeployBase is Deploy {
return address(new DSROracleForwarderBaseChain(MCD_POT, receiver));
}

function deployReceiver(address forwarder, IDSRAuthOracle oracle) internal override returns (address) {
return address(new DSROracleReceiverOptimism(forwarder, oracle));
function deployReceiver(address forwarder, address oracle) internal override returns (address) {
return address(new OptimismReceiver(forwarder, oracle));
}

}
Expand All @@ -111,8 +111,8 @@ contract DeployGnosis is Deploy {
return address(new DSROracleForwarderGnosis(MCD_POT, receiver));
}

function deployReceiver(address forwarder, IDSRAuthOracle oracle) internal override returns (address) {
return address(new DSROracleReceiverGnosis(Gnosis.L2_AMB, 1, forwarder, oracle));
function deployReceiver(address forwarder, address oracle) internal override returns (address) {
return address(new AMBReceiver(Gnosis.L2_AMB, bytes32(uint256(1)), forwarder, oracle));
}

}
Expand All @@ -127,8 +127,8 @@ contract DeployArbitrumOne is Deploy {
return address(new DSROracleForwarderArbitrumOne(MCD_POT, receiver));
}

function deployReceiver(address forwarder, IDSRAuthOracle oracle) internal override returns (address) {
return address(new DSROracleReceiverArbitrum(forwarder, oracle));
function deployReceiver(address forwarder, address oracle) internal override returns (address) {
return address(new ArbitrumReceiver(forwarder, oracle));
}

}
5 changes: 3 additions & 2 deletions src/forwarders/DSROracleForwarderArbitrumOne.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.0;

import { XChainForwarders } from 'xchain-helpers/XChainForwarders.sol';
import { ArbitrumForwarder } from 'xchain-helpers/forwarders/ArbitrumForwarder.sol';

import { DSROracleForwarderBase } from './DSROracleForwarderBase.sol';

Expand All @@ -16,7 +16,8 @@ contract DSROracleForwarderArbitrumOne is DSROracleForwarderBase {
uint256 maxFeePerGas,
uint256 baseFee
) public payable {
XChainForwarders.sendMessageArbitrumOne(
ArbitrumForwarder.sendMessageL1toL2(
ArbitrumForwarder.L1_CROSS_DOMAIN_ARBITRUM_ONE,
address(l2Oracle),
_packMessage(),
gasLimit,
Expand Down
5 changes: 3 additions & 2 deletions src/forwarders/DSROracleForwarderBaseChain.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.0;

import { XChainForwarders } from 'xchain-helpers/XChainForwarders.sol';
import { OptimismForwarder } from 'xchain-helpers/forwarders/OptimismForwarder.sol';

import { DSROracleForwarderBase } from './DSROracleForwarderBase.sol';

Expand All @@ -12,7 +12,8 @@ contract DSROracleForwarderBaseChain is DSROracleForwarderBase {
}

function refresh(uint256 gasLimit) public {
XChainForwarders.sendMessageBase(
OptimismForwarder.sendMessageL1toL2(
OptimismForwarder.L1_CROSS_DOMAIN_BASE,
address(l2Oracle),
_packMessage(),
gasLimit
Expand Down
4 changes: 2 additions & 2 deletions src/forwarders/DSROracleForwarderGnosis.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.0;

import { XChainForwarders } from 'xchain-helpers/XChainForwarders.sol';
import { AMBForwarder } from 'xchain-helpers/forwarders/AMBForwarder.sol';

import { DSROracleForwarderBase } from './DSROracleForwarderBase.sol';

Expand All @@ -12,7 +12,7 @@ contract DSROracleForwarderGnosis is DSROracleForwarderBase {
}

function refresh(uint256 gasLimit) public {
XChainForwarders.sendMessageGnosis(
AMBForwarder.sendMessageEthereumToGnosisChain(
address(l2Oracle),
_packMessage(),
gasLimit
Expand Down
5 changes: 3 additions & 2 deletions src/forwarders/DSROracleForwarderOptimism.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.0;

import { XChainForwarders } from 'xchain-helpers/XChainForwarders.sol';
import { OptimismForwarder } from 'xchain-helpers/forwarders/OptimismForwarder.sol';

import { DSROracleForwarderBase } from './DSROracleForwarderBase.sol';

Expand All @@ -12,7 +12,8 @@ contract DSROracleForwarderOptimism is DSROracleForwarderBase {
}

function refresh(uint256 gasLimit) public {
XChainForwarders.sendMessageOptimismMainnet(
OptimismForwarder.sendMessageL1toL2(
OptimismForwarder.L1_CROSS_DOMAIN_OPTIMISM,
address(l2Oracle),
_packMessage(),
gasLimit
Expand Down
23 changes: 0 additions & 23 deletions src/receivers/DSROracleReceiverArbitrum.sol

This file was deleted.

25 changes: 0 additions & 25 deletions src/receivers/DSROracleReceiverGnosis.sol

This file was deleted.

23 changes: 0 additions & 23 deletions src/receivers/DSROracleReceiverOptimism.sol

This file was deleted.

163 changes: 0 additions & 163 deletions test/DSROracleConfigs.t.sol

This file was deleted.

Loading

0 comments on commit b868f15

Please sign in to comment.