diff --git a/.github/workflows/rainix.yaml b/.github/workflows/rainix.yaml index 30b1e589..13b885b8 100644 --- a/.github/workflows/rainix.yaml +++ b/.github/workflows/rainix.yaml @@ -26,4 +26,5 @@ jobs: ETH_RPC_URL: ${{ secrets.CI_DEPLOY_RPC_URL }} ETHERSCAN_API_KEY: ${{ secrets.EXPLORER_VERIFICATION_KEY }} RPC_URL_FLARE_FORK: ${{ secrets.RPC_URL_FLARE_FORK }} + RPC_URL_ARBITRUM_SEPOLIA_FORK: ${{ secrets.RPC_URL_ARBITRUM_SEPOLIA_FORK }} run: nix develop -c ${{ matrix.task }} \ No newline at end of file diff --git a/test/lib/LibOffchainAssetReceiptVaultFork.sol b/test/lib/LibOffchainAssetReceiptVaultFork.sol new file mode 100644 index 00000000..c89b5aca --- /dev/null +++ b/test/lib/LibOffchainAssetReceiptVaultFork.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: LicenseRef-DCL-1.0 +// SPDX-FileCopyrightText: Copyright (c) 2020 thedavidmeister +pragma solidity ^0.8.25; + +import {OffchainAssetReceiptVault} from "src/concrete/vault/OffchainAssetReceiptVault.sol"; +import {LibFork} from "rain.flare/../test/fork/LibFork.sol"; +import {Math} from "rain.math.fixedpoint/lib/LibFixedPointDecimalArithmeticOpenZeppelin.sol"; +import {Vm} from "forge-std/Vm.sol"; + +library LibOffchainAssetReceiptVaultFork { + function setup(Vm vm) internal returns (OffchainAssetReceiptVault, address) { + address alice = address(0xc0D477556c25C9d67E1f57245C7453DA776B51cf); + + // Contract address on Arbitrum Sepolia + OffchainAssetReceiptVault vault = OffchainAssetReceiptVault(payable(0xb012B4DE7b960A537ed485771278Ba222c56Aff3)); + + // Use an environment variable for the RPC URL + string memory rpcURL = vm.envString("RPC_URL_ARBITRUM_SEPOLIA_FORK"); + uint256 BLOCK_NUMBER = 96365164; + + vm.createSelectFork(rpcURL, BLOCK_NUMBER); + + return (vault, alice); + } +} diff --git a/test/src/concrete/vault/OffchainAssetReceiptVault.certify.t.sol b/test/src/concrete/vault/OffchainAssetReceiptVault.certify.t.sol index 88070d5f..1f9a2cb4 100644 --- a/test/src/concrete/vault/OffchainAssetReceiptVault.certify.t.sol +++ b/test/src/concrete/vault/OffchainAssetReceiptVault.certify.t.sol @@ -11,6 +11,7 @@ import { import {IReceiptV1} from "src/interface/IReceiptV1.sol"; import {OffchainAssetReceiptVaultTest, Vm} from "test/abstract/OffchainAssetReceiptVaultTest.sol"; import {LibOffchainAssetVaultCreator} from "test/lib/LibOffchainAssetVaultCreator.sol"; +import {LibOffchainAssetReceiptVaultFork} from "test/lib/LibOffchainAssetReceiptVaultFork.sol"; import {IReceiptVaultV1} from "src/interface/IReceiptVaultV1.sol"; import {LibUniqueAddressesGenerator} from "../../../lib/LibUniqueAddressesGenerator.sol"; @@ -320,4 +321,20 @@ contract CertifyTest is OffchainAssetReceiptVaultTest { vm.stopPrank(); } + + /// forge-config: default.fuzz.runs = 1 + function testCertifyArbitrumSepoliaFork(bool forceUntil, uint256 certifyUntil) public { + vm.assume(certifyUntil > block.timestamp); + (OffchainAssetReceiptVault vault, address alice) = LibOffchainAssetReceiptVaultFork.setup(vm); + + vm.startPrank(alice); + + uint256 referenceBlockNumber = block.number; + + // Grant CERTIFIER role to alice + vault.grantRole(vault.CERTIFIER(), alice); + vault.certify(certifyUntil, referenceBlockNumber, forceUntil, ""); + + vm.stopPrank(); + } }