Add Oracle Aggregator and CCIP Integration
- Introduced Aggregator.sol for Chainlink-compatible oracle functionality, including round-based updates and access control. - Added OracleWithCCIP.sol to extend Aggregator with CCIP cross-chain messaging capabilities. - Created .gitmodules to include OpenZeppelin contracts as a submodule. - Developed a comprehensive deployment guide in NEXT_STEPS_COMPLETE_GUIDE.md for Phase 2 and smart contract deployment. - Implemented Vite configuration for the orchestration portal, supporting both Vue and React frameworks. - Added server-side logic for the Multi-Cloud Orchestration Portal, including API endpoints for environment management and monitoring. - Created scripts for resource import and usage validation across non-US regions. - Added tests for CCIP error handling and integration to ensure robust functionality. - Included various new files and directories for the orchestration portal and deployment scripts.
This commit is contained in:
69
test/Multicall.t.sol
Normal file
69
test/Multicall.t.sol
Normal file
@@ -0,0 +1,69 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.19;
|
||||
|
||||
import {Test, console} from "forge-std/Test.sol";
|
||||
import {Multicall} from "../contracts/utils/Multicall.sol";
|
||||
import {WETH} from "../contracts/tokens/WETH.sol";
|
||||
|
||||
contract MulticallTest is Test {
|
||||
Multicall public multicall;
|
||||
WETH public weth;
|
||||
|
||||
function setUp() public {
|
||||
multicall = new Multicall();
|
||||
weth = new WETH();
|
||||
vm.deal(address(this), 10 ether);
|
||||
}
|
||||
|
||||
function testAggregate() public {
|
||||
weth.deposit{value: 1 ether}();
|
||||
|
||||
Multicall.Call[] memory calls = new Multicall.Call[](2);
|
||||
calls[0] = Multicall.Call({
|
||||
target: address(weth),
|
||||
callData: abi.encodeWithSignature("totalSupply()")
|
||||
});
|
||||
calls[1] = Multicall.Call({
|
||||
target: address(weth),
|
||||
callData: abi.encodeWithSignature("balanceOf(address)", address(this))
|
||||
});
|
||||
|
||||
bytes[] memory results = multicall.aggregate(calls);
|
||||
|
||||
uint256 totalSupply = abi.decode(results[0], (uint256));
|
||||
uint256 balance = abi.decode(results[1], (uint256));
|
||||
|
||||
assertEq(totalSupply, 1 ether);
|
||||
assertEq(balance, 1 ether);
|
||||
}
|
||||
|
||||
function testTryAggregate() public {
|
||||
weth.deposit{value: 1 ether}();
|
||||
|
||||
Multicall.Call[] memory calls = new Multicall.Call[](2);
|
||||
calls[0] = Multicall.Call({
|
||||
target: address(weth),
|
||||
callData: abi.encodeWithSignature("totalSupply()")
|
||||
});
|
||||
calls[1] = Multicall.Call({
|
||||
target: address(0xdead),
|
||||
callData: abi.encodeWithSignature("balanceOf(address)", address(this))
|
||||
});
|
||||
|
||||
Multicall.Result[] memory results = multicall.tryAggregate(false, calls);
|
||||
|
||||
assertTrue(results[0].success);
|
||||
assertFalse(results[1].success);
|
||||
}
|
||||
|
||||
function testGetChainId() public {
|
||||
uint256 chainId = multicall.getChainId();
|
||||
assertEq(chainId, block.chainid);
|
||||
}
|
||||
|
||||
function testGetCurrentBlockNumber() public {
|
||||
uint256 blockNumber = multicall.getCurrentBlockNumber();
|
||||
assertEq(blockNumber, block.number);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user