Files
smom-dbis-138/test/WETH.t.sol
defiQUG 1fb7266469 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.
2025-12-12 14:57:48 -08:00

70 lines
1.8 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import {Test, console} from "forge-std/Test.sol";
import {WETH} from "../contracts/tokens/WETH.sol";
contract WETHTest is Test {
WETH public weth;
address public user = address(1);
function setUp() public {
weth = new WETH();
vm.deal(user, 10 ether);
}
function testDeposit() public {
vm.prank(user);
weth.deposit{value: 1 ether}();
assertEq(weth.balanceOf(user), 1 ether);
assertEq(weth.totalSupply(), 1 ether);
}
function testWithdraw() public {
vm.prank(user);
weth.deposit{value: 1 ether}();
uint256 balanceBefore = user.balance;
vm.prank(user);
weth.withdraw(1 ether);
assertEq(weth.balanceOf(user), 0);
assertEq(user.balance, balanceBefore + 1 ether);
}
function testTransfer() public {
address recipient = address(2);
vm.prank(user);
weth.deposit{value: 1 ether}();
vm.prank(user);
weth.transfer(recipient, 0.5 ether);
assertEq(weth.balanceOf(user), 0.5 ether);
assertEq(weth.balanceOf(recipient), 0.5 ether);
}
function testApprove() public {
address spender = address(2);
vm.prank(user);
weth.deposit{value: 1 ether}();
vm.prank(user);
weth.approve(spender, 0.5 ether);
assertEq(weth.allowance(user, spender), 0.5 ether);
}
function testReceive() public {
vm.prank(user);
(bool success, ) = address(weth).call{value: 1 ether}("");
require(success, "Transfer failed");
assertEq(weth.balanceOf(user), 1 ether);
}
}