Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m3s
CI/CD Pipeline / Security Scanning (push) Successful in 2m18s
CI/CD Pipeline / Lint and Format (push) Failing after 34s
CI/CD Pipeline / Terraform Validation (push) Failing after 20s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 22s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 40s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 49s
OMNL reconcile anchor / Run omnl:reconcile and upload artifacts (push) Failing after 21s
Validation / validate-genesis (push) Successful in 25s
Validation / validate-terraform (push) Failing after 21s
Validation / validate-kubernetes (push) Failing after 8s
Validation / validate-smart-contracts (push) Failing after 8s
Validation / validate-security (push) Failing after 1m11s
Validation / validate-documentation (push) Failing after 14s
Verify Deployment / Verify Deployment (push) Failing after 45s
Ship AddressActivityRegistry V1/V2, ISO20022IntakeGateway, Chain138ParticipantSurface, checkpoint hub contracts, checkpoint-core package, aggregator/indexer/sdk services, relay profile guards, M00 diamond bridge facet, and OMNL compliance contracts. Co-authored-by: Cursor <cursoragent@cursor.com>
43 lines
1.8 KiB
Solidity
43 lines
1.8 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.20;
|
|
|
|
import {CheckpointLeaf} from "./CheckpointLeaf.sol";
|
|
import {CheckpointErrors} from "./CheckpointErrors.sol";
|
|
|
|
/// @notice External library to keep hub implementation under 24KB (EIP-170).
|
|
library CheckpointPaymentsLib {
|
|
function assertPaymentsRootV1(
|
|
uint64 chainId,
|
|
bytes32 paymentsRoot,
|
|
CheckpointLeaf.PaymentLeafV1[] calldata leaves
|
|
) external pure {
|
|
if (leaves.length == 0) revert CheckpointErrors.LeavesEmpty();
|
|
bytes32[] memory hashes = new bytes32[](leaves.length);
|
|
for (uint256 i = 0; i < leaves.length; i++) {
|
|
hashes[i] = CheckpointLeaf.paymentLeafV1(chainId, leaves[i]);
|
|
}
|
|
if (CheckpointLeaf.buildMerkleRoot(hashes) != paymentsRoot) revert CheckpointErrors.RootMismatch();
|
|
}
|
|
|
|
function assertPaymentsRootV2(
|
|
uint64 chainId,
|
|
bytes32 paymentsRoot,
|
|
CheckpointLeaf.PaymentLeafV2[] calldata leaves
|
|
) external pure {
|
|
if (leaves.length == 0) revert CheckpointErrors.LeavesEmpty();
|
|
bytes32[] memory hashes = new bytes32[](leaves.length);
|
|
for (uint256 i = 0; i < leaves.length; i++) {
|
|
hashes[i] = CheckpointLeaf.paymentLeafV2(chainId, leaves[i]);
|
|
}
|
|
if (CheckpointLeaf.buildMerkleRoot(hashes) != paymentsRoot) revert CheckpointErrors.RootMismatch();
|
|
}
|
|
|
|
function enforceMinPaymentValueV1(bytes calldata extensionData, uint256 minWei) external pure {
|
|
if (minWei == 0 || extensionData.length == 0) return;
|
|
CheckpointLeaf.PaymentLeafV1[] memory leaves = abi.decode(extensionData, (CheckpointLeaf.PaymentLeafV1[]));
|
|
for (uint256 i = 0; i < leaves.length; i++) {
|
|
if (leaves[i].value < minWei) revert CheckpointErrors.BelowMinPayment();
|
|
}
|
|
}
|
|
}
|