feat(chain138): Monad CCIP, token aggregation OMNL gates, HYBX client, and PMM deploy updates.
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m11s
CI/CD Pipeline / Security Scanning (push) Has been cancelled
CI/CD Pipeline / Lint and Format (push) Has been cancelled
CI/CD Pipeline / Terraform Validation (push) Has been cancelled
CI/CD Pipeline / Kubernetes Validation (push) Has been cancelled
Validation / validate-genesis (push) Has been cancelled
Validation / validate-terraform (push) Has been cancelled
Validation / validate-kubernetes (push) Has been cancelled
Validation / validate-smart-contracts (push) Has been cancelled
Validation / validate-security (push) Has been cancelled
Validation / validate-documentation (push) Has been cancelled
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 1m4s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 31s
OMNL reconcile anchor / Run omnl:reconcile and upload artifacts (push) Failing after 29s
Verify Deployment / Verify Deployment (push) Failing after 57s
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m11s
CI/CD Pipeline / Security Scanning (push) Has been cancelled
CI/CD Pipeline / Lint and Format (push) Has been cancelled
CI/CD Pipeline / Terraform Validation (push) Has been cancelled
CI/CD Pipeline / Kubernetes Validation (push) Has been cancelled
Validation / validate-genesis (push) Has been cancelled
Validation / validate-terraform (push) Has been cancelled
Validation / validate-kubernetes (push) Has been cancelled
Validation / validate-smart-contracts (push) Has been cancelled
Validation / validate-security (push) Has been cancelled
Validation / validate-documentation (push) Has been cancelled
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 1m4s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 31s
OMNL reconcile anchor / Run omnl:reconcile and upload artifacts (push) Failing after 29s
Verify Deployment / Verify Deployment (push) Failing after 57s
Relay router, reserve system, oracle publisher, token-aggregation compliance middleware, and Monad deployment scripts. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -357,6 +357,33 @@ contract CWMultiTokenBridgeTest is Test {
|
||||
assertEq(keccak256(receiveBridge.lastData()), keccak256(message.data));
|
||||
}
|
||||
|
||||
function testRelayRouterDeliversToCWMultiTokenBridgeL2() public {
|
||||
CCIPRelayRouter relayRouter = new CCIPRelayRouter();
|
||||
relayRouter.authorizeBridge(address(l2Bridge));
|
||||
relayRouter.grantRelayerRole(address(this));
|
||||
|
||||
l2Bridge.setReceiveRouter(address(relayRouter));
|
||||
|
||||
uint256 amount = 50e6;
|
||||
bytes memory outboundData = abi.encode(address(canonical), user, amount);
|
||||
bytes32 messageId = keccak256("relay-router-l2");
|
||||
|
||||
LegacyRouterClient.TokenAmount[] memory noTokens = new LegacyRouterClient.TokenAmount[](0);
|
||||
LegacyRouterClient.Any2EVMMessage memory message = LegacyRouterClient.Any2EVMMessage({
|
||||
messageId: messageId,
|
||||
sourceChainSelector: CHAIN138_SELECTOR,
|
||||
sender: abi.encode(address(l1Bridge)),
|
||||
data: outboundData,
|
||||
tokenAmounts: noTokens
|
||||
});
|
||||
|
||||
relayRouter.relayMessage(address(l2Bridge), message);
|
||||
|
||||
assertTrue(l2Bridge.processed(messageId));
|
||||
assertEq(wrapped.balanceOf(user), amount);
|
||||
assertEq(l2Bridge.mintedTotal(address(wrapped)), amount);
|
||||
}
|
||||
|
||||
function _l1Message(
|
||||
bytes32 messageId,
|
||||
uint64 sourceChainSelector,
|
||||
|
||||
49
test/reserve/ReserveConversionPriceAdapter.t.sol
Normal file
49
test/reserve/ReserveConversionPriceAdapter.t.sol
Normal file
@@ -0,0 +1,49 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {Test} from "forge-std/Test.sol";
|
||||
import {ReserveSystem} from "../../contracts/reserve/ReserveSystem.sol";
|
||||
import {ReserveConversionPriceAdapter} from "../../contracts/reserve/ReserveConversionPriceAdapter.sol";
|
||||
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
|
||||
contract MockERC20Adapter is ERC20 {
|
||||
constructor(string memory name, string memory symbol) ERC20(name, symbol) {}
|
||||
}
|
||||
|
||||
contract ReserveConversionPriceAdapterTest is Test {
|
||||
ReserveSystem public reserveSystem;
|
||||
ReserveConversionPriceAdapter public adapter;
|
||||
MockERC20Adapter public weth;
|
||||
MockERC20Adapter public usdc;
|
||||
|
||||
address public admin = address(0x1);
|
||||
address public priceFeedOperator = address(0x3);
|
||||
|
||||
function setUp() public {
|
||||
reserveSystem = new ReserveSystem(admin);
|
||||
adapter = new ReserveConversionPriceAdapter(address(reserveSystem));
|
||||
weth = new MockERC20Adapter("WETH", "WETH");
|
||||
usdc = new MockERC20Adapter("USDC", "USDC");
|
||||
|
||||
vm.startPrank(admin);
|
||||
reserveSystem.grantRole(reserveSystem.PRICE_FEED_ROLE(), priceFeedOperator);
|
||||
reserveSystem.addSupportedAsset(address(weth), true);
|
||||
reserveSystem.addSupportedAsset(address(usdc), true);
|
||||
vm.stopPrank();
|
||||
|
||||
vm.startPrank(priceFeedOperator);
|
||||
reserveSystem.updatePriceFeed(address(weth), 1732e18, block.timestamp);
|
||||
reserveSystem.updatePriceFeed(address(usdc), 1e18, block.timestamp);
|
||||
vm.stopPrank();
|
||||
}
|
||||
|
||||
function test_adapter_getConversionPrice_quotePerBase() public view {
|
||||
uint256 conv = adapter.getConversionPrice(address(weth), address(usdc));
|
||||
assertEq(conv, 1732e18);
|
||||
}
|
||||
|
||||
function test_adapter_getPrice_delegates() public view {
|
||||
(uint256 price,) = adapter.getPrice(address(weth));
|
||||
assertEq(price, 1732e18);
|
||||
}
|
||||
}
|
||||
@@ -122,8 +122,8 @@ contract ReserveSystemTest is Test {
|
||||
);
|
||||
|
||||
// asset1 price: 1000, asset2 price: 2000
|
||||
// 100 * 1e18 * 2000 / 1000 = 200 * 1e18
|
||||
assertEq(targetAmount, 200 * 1e18);
|
||||
// 100 * 1000 / 2000 = 50 asset2 (equal USD value)
|
||||
assertEq(targetAmount, 50 * 1e18);
|
||||
assertGt(fees, 0);
|
||||
assertEq(path.length, 2);
|
||||
assertEq(path[0], address(asset1));
|
||||
@@ -139,6 +139,19 @@ contract ReserveSystemTest is Test {
|
||||
assertEq(timestamp, block.timestamp);
|
||||
}
|
||||
|
||||
function test_getConversionPrice_targetPerSource() public {
|
||||
// asset1 $1000, asset2 $2000 -> 0.5 asset2 per 1 asset1
|
||||
uint256 conv = reserveSystem.getConversionPrice(address(asset1), address(asset2));
|
||||
assertEq(conv, 0.5e18);
|
||||
|
||||
vm.prank(priceFeedOperator);
|
||||
reserveSystem.updatePriceFeed(address(asset1), 1732e18, block.timestamp);
|
||||
vm.prank(priceFeedOperator);
|
||||
reserveSystem.updatePriceFeed(address(asset2), 1e18, block.timestamp);
|
||||
conv = reserveSystem.getConversionPrice(address(asset1), address(asset2));
|
||||
assertEq(conv, 1732e18);
|
||||
}
|
||||
|
||||
function test_redeem() public {
|
||||
// Set up reserves
|
||||
asset1.mint(reserveManager, 1000 * 1e18);
|
||||
|
||||
Reference in New Issue
Block a user