generated from bgd-labs/bgd-forge-template
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
63 additions
and
87 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
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
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
43 changes: 43 additions & 0 deletions
43
src/20240305_Multi_ADIAndBridgeAdaptersUpdate/BaseTest.sol
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,43 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import 'forge-std/Test.sol'; | ||
import {ICrossChainReceiver, ICrossChainForwarder} from 'aave-address-book/common/ICrossChainController.sol'; | ||
import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; | ||
import {ChainIds} from 'aave-helpers/ChainIds.sol'; | ||
import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; | ||
|
||
contract BaseTest is Test { | ||
address public ccc; | ||
address public proxyAdmin; | ||
|
||
function _checkAdapterCorrectness(uint256 chainId, address[] memory adapters) internal { | ||
ICrossChainForwarder.ChainIdBridgeConfig[] | ||
memory forwarderBridgeAdapters = ICrossChainForwarder(ccc).getForwarderBridgeAdaptersByChain( | ||
chainId | ||
); | ||
|
||
assertEq(adapters.length, forwarderBridgeAdapters.length); | ||
|
||
uint256 adaptersCount; | ||
for (uint256 i = 0; i < forwarderBridgeAdapters.length; i++) { | ||
for (uint256 j = 0; j < adapters.length; j++) { | ||
if (forwarderBridgeAdapters[i].currentChainBridgeAdapter == adapters[j]) { | ||
adaptersCount++; | ||
} | ||
} | ||
} | ||
assertEq(adaptersCount, forwarderBridgeAdapters.length); | ||
} | ||
|
||
function _testReceiverAdapterAllowed(address adapter, uint256 chainId, bool allowed) internal { | ||
assertEq(ICrossChainReceiver(ccc).isReceiverBridgeAdapterAllowed(adapter, chainId), allowed); | ||
} | ||
|
||
function _testImplementationAddress(address implementation, bool equal) internal { | ||
address cccImplementation = ProxyAdmin(proxyAdmin).getProxyImplementation( | ||
TransparentUpgradeableProxy(payable(ccc)) | ||
); | ||
assertEq(cccImplementation == implementation, equal); | ||
} | ||
} |