Skip to content

Commit

Permalink
Dedup weth and move to vendor (#16141)
Browse files Browse the repository at this point in the history
* move ccip weth to vendor

* automation weth

* gen in shared

* swap out usage

* changeset

* [Bot] Update changeset file with jira issues

* fix import

---------

Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 5db1008 commit 16a7985
Show file tree
Hide file tree
Showing 28 changed files with 58 additions and 1,155 deletions.
10 changes: 10 additions & 0 deletions contracts/.changeset/gold-items-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@chainlink/contracts': patch
---

#internal move multiple weth9 implementations to vendor


PR issue: CCIP-5081

Solidity Review issue: CCIP-3966
1 change: 0 additions & 1 deletion contracts/scripts/native_solc_compile_all_automation
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,3 @@ compileContract automation/v2_3/AutomationUtils2_3.sol
compileContract automation/interfaces/v2_3/IAutomationRegistryMaster2_3.sol

compileContract automation/testhelpers/MockETHUSDAggregator.sol
compileContract automation/test/WETH9.sol
1 change: 0 additions & 1 deletion contracts/scripts/native_solc_compile_all_ccip
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ compileContract test/helpers/receivers/LogMessageDataReceiver
compileContract test/helpers/MultiOCR3Helper
compileContract test/mocks/MockE2EUSDCTokenMessenger
compileContract test/mocks/MockE2EUSDCTransmitter
compileContract test/WETH9
compileContract test/helpers/CCIPReaderTester
# Offchain test encoding utils
compileContract test/helpers/EncodingUtils
Expand Down
1 change: 1 addition & 0 deletions contracts/scripts/native_solc_compile_all_shared
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ compileContract mocks/WERC20Mock

compileContract openzeppelin-solidity/v4.8.3/contracts/token/ERC20/ERC20 vendor
compileContract multicall/ebd8b64/src/Multicall3 vendor
compileContract canonical-weth/WETH9 vendor
93 changes: 0 additions & 93 deletions contracts/src/v0.8/automation/test/WETH9.sol

This file was deleted.

15 changes: 8 additions & 7 deletions contracts/src/v0.8/automation/test/v2_3/BaseTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity 0.8.19;
import "forge-std/Test.sol";

import {LinkToken} from "../../../shared/token/ERC677/LinkToken.sol";
import {ERC20Mock} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/mocks/ERC20Mock.sol";
import {ERC20Mock6Decimals} from "../../mocks/ERC20Mock6Decimals.sol";
import {MockV3Aggregator} from "../../../shared/mocks/MockV3Aggregator.sol";
import {AutomationForwarderLogic} from "../../AutomationForwarderLogic.sol";
Expand All @@ -17,10 +16,12 @@ import {AutomationRegistryLogicC2_3} from "../../v2_3/AutomationRegistryLogicC2_
import {IAutomationRegistryMaster2_3 as Registry, AutomationRegistryBase2_3} from "../../interfaces/v2_3/IAutomationRegistryMaster2_3.sol";
import {AutomationRegistrar2_3} from "../../v2_3/AutomationRegistrar2_3.sol";
import {ChainModuleBase} from "../../chains/ChainModuleBase.sol";
import {IERC20Metadata as IERC20} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {MockUpkeep} from "../../mocks/MockUpkeep.sol";
import {IWrappedNative} from "../../interfaces/v2_3/IWrappedNative.sol";
import {WETH9} from "../WETH9.sol";

import {ERC20Mock} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/mocks/ERC20Mock.sol";
import {IERC20Metadata as IERC20} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {WETH9} from "../../../vendor/canonical-weth/WETH9.sol";

/**
* @title BaseTest provides basic test setup procedures and dependencies for use by other
Expand Down Expand Up @@ -137,10 +138,10 @@ contract BaseTest is Test {
usdToken6.mint(FINANCE_ADMIN, 1000e6);
usdToken6.mint(STRANGER, 1000e6);

weth.mint(OWNER, 1000e18);
weth.mint(UPKEEP_ADMIN, 1000e18);
weth.mint(FINANCE_ADMIN, 1000e18);
weth.mint(STRANGER, 1000e18);
deal(address(weth), OWNER, 100 ether);
deal(address(weth), UPKEEP_ADMIN, 100 ether);
deal(address(weth), FINANCE_ADMIN, 100 ether);
deal(address(weth), STRANGER, 100 ether);

vm.stopPrank();
}
Expand Down
15 changes: 8 additions & 7 deletions contracts/src/v0.8/automation/test/v2_3_zksync/BaseTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity 0.8.19;
import "forge-std/Test.sol";

import {LinkToken} from "../../../shared/token/ERC677/LinkToken.sol";
import {ERC20Mock} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/mocks/ERC20Mock.sol";
import {ERC20Mock6Decimals} from "../../mocks/ERC20Mock6Decimals.sol";
import {MockV3Aggregator} from "../../../shared/mocks/MockV3Aggregator.sol";
import {AutomationForwarderLogic} from "../../AutomationForwarderLogic.sol";
Expand All @@ -17,13 +16,15 @@ import {ZKSyncAutomationRegistryBase2_3 as ZKSyncAutoBase} from "../../v2_3_zksy
import {IAutomationRegistryMaster2_3 as Registry, AutomationRegistryBase2_3} from "../../interfaces/v2_3/IAutomationRegistryMaster2_3.sol";
import {AutomationRegistrar2_3} from "../../v2_3/AutomationRegistrar2_3.sol";
import {ChainModuleBase} from "../../chains/ChainModuleBase.sol";
import {IERC20Metadata as IERC20} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {MockUpkeep} from "../../mocks/MockUpkeep.sol";
import {IWrappedNative} from "../../interfaces/v2_3/IWrappedNative.sol";
import {WETH9} from "../WETH9.sol";
import {MockGasBoundCaller} from "../../mocks/MockGasBoundCaller.sol";
import {MockZKSyncSystemContext} from "../../mocks/MockZKSyncSystemContext.sol";

import {ERC20Mock} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/mocks/ERC20Mock.sol";
import {IERC20Metadata as IERC20} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {WETH9} from "../../../vendor/canonical-weth/WETH9.sol";

/**
* @title BaseTest provides basic test setup procedures and dependencies for use by other
* unit tests
Expand Down Expand Up @@ -149,10 +150,10 @@ contract BaseTest is Test {
usdToken6.mint(FINANCE_ADMIN, 1000e6);
usdToken6.mint(STRANGER, 1000e6);

weth.mint(OWNER, 1000e18);
weth.mint(UPKEEP_ADMIN, 1000e18);
weth.mint(FINANCE_ADMIN, 1000e18);
weth.mint(STRANGER, 1000e18);
deal(address(weth), OWNER, 100 ether);
deal(address(weth), UPKEEP_ADMIN, 100 ether);
deal(address(weth), FINANCE_ADMIN, 100 ether);
deal(address(weth), STRANGER, 100 ether);

vm.stopPrank();
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/test/BaseTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {IRMNRemote} from "../interfaces/IRMNRemote.sol";
import {Router} from "../Router.sol";
import {Internal} from "../libraries/Internal.sol";
import {RateLimiter} from "../libraries/RateLimiter.sol";
import {WETH9} from "./WETH9.sol";

import {WETH9} from "../../vendor/canonical-weth/WETH9.sol";
import {Test} from "forge-std/Test.sol";

contract BaseTest is Test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {Test} from "forge-std/Test.sol";

import {ICCIPRouter} from "../../../applications/EtherSenderReceiver.sol";

import {WETH9} from "../../WETH9.sol";
import {EtherSenderReceiverHelper} from "../../helpers/EtherSenderReceiverHelper.sol";

import {WETH9} from "../../../../vendor/canonical-weth/WETH9.sol";
import {ERC20} from "../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/ERC20.sol";

contract EtherSenderReceiverTestSetup is Test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ pragma solidity ^0.8.24;

import {Test} from "forge-std/Test.sol";

import {WETH9} from "../../ccip/test/WETH9.sol";

import {ERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/ERC20.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
import {WETH9} from "../../vendor/canonical-weth/WETH9.sol";

contract LiquidityManagerBaseTest is Test {
IERC20 internal s_l1Token;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ pragma solidity 0.8.24;
import "forge-std/Test.sol";

import {IWrappedNative} from "../../../ccip/interfaces/IWrappedNative.sol";
import {WETH9} from "../../../ccip/test/WETH9.sol";
import {OptimismL1BridgeAdapter} from "../../bridge-adapters/OptimismL1BridgeAdapter.sol";
import {Types} from "../../interfaces/optimism/Types.sol";
import {IOptimismPortal} from "../../interfaces/optimism/IOptimismPortal.sol";

import {IL1StandardBridge} from "@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol";

import {IERC20} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
import {WETH9} from "../../../vendor/canonical-weth/WETH9.sol";

contract OptimismL1BridgeAdapterSetup is Test {
// addresses below are fake
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity ^0.8.24;
pragma solidity ^0.8.0;

// solhint-disable
contract WETH9 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ token_admin_registry: ../../../contracts/solc/ccip/TokenAdminRegistry/TokenAdmin
token_pool: ../../../contracts/solc/ccip/TokenPool/TokenPool.sol/TokenPool.abi.json ../../../contracts/solc/ccip/TokenPool/TokenPool.sol/TokenPool.bin 6c00ce7b2082f40d5f9b4808eb692a90e81c312b4f5d70d62e4b1ef69a164a9f
usdc_reader_tester: ../../../contracts/solc/ccip/USDCReaderTester/USDCReaderTester.sol/USDCReaderTester.abi.json ../../../contracts/solc/ccip/USDCReaderTester/USDCReaderTester.sol/USDCReaderTester.bin 7622b1e42bc9c3933c51607d765d8463796c615155596929e554a58ed68b263d
usdc_token_pool: ../../../contracts/solc/ccip/USDCTokenPool/USDCTokenPool.sol/USDCTokenPool.abi.json ../../../contracts/solc/ccip/USDCTokenPool/USDCTokenPool.sol/USDCTokenPool.bin 8a44f8d2d193fc1332e5e80a5e05172dc15680e0921d7cc945ea321746f764fc
weth9: ../../../contracts/solc/ccip/WETH9/WETH9.sol/WETH9.abi.json ../../../contracts/solc/ccip/WETH9/WETH9.sol/WETH9.bin 89ee9892414b4d9abfb18046504aa7771c88c52a0831479ca4152f120e647d49
1 change: 0 additions & 1 deletion core/gethwrappers/ccip/go_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ package ccip
//go:generate go run ../generation/wrap.go ccip USDCReaderTester usdc_reader_tester
//go:generate go run ../generation/wrap.go ccip ReportCodec report_codec
//go:generate go run ../generation/wrap.go ccip EtherSenderReceiver ether_sender_receiver
//go:generate go run ../generation/wrap.go ccip WETH9 weth9
//go:generate go run ../generation/wrap.go ccip MockE2EUSDCTokenMessenger mock_usdc_token_messenger
//go:generate go run ../generation/wrap.go ccip MockE2EUSDCTransmitter mock_usdc_token_transmitter
//go:generate go run ../generation/wrap.go ccip CCIPReaderTester ccip_reader_tester
Expand Down
Loading

0 comments on commit 16a7985

Please sign in to comment.