Files
aitbc/contracts/test/fuzz/EscrowService.t.sol
oib 15427c96c0 chore: update file permissions to executable across repository
- Change file mode from 644 to 755 for all project files
- Add chain_id parameter to get_balance RPC endpoint with default "ait-devnet"
- Rename Miner.extra_meta_data to extra_metadata for consistency
2026-03-06 22:17:54 +01:00

37 lines
1.0 KiB
Solidity
Executable File

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "forge-std/Test.sol";
import "../../contracts/EscrowService.sol";
contract EscrowServiceFuzzTest is Test {
EscrowService public escrow;
address public owner;
address public provider;
address payable public client;
function setUp() public {
owner = address(this);
provider = makeAddr("provider");
client = payable(makeAddr("client"));
escrow = new EscrowService();
}
function invariant_balanceInvariant() public {
assertEq(address(escrow).balance, 0, "Escrow should hold no stray ETH after operations");
}
function testFuzz_EscrowFlow(uint256 amount) public {
vm.assume(amount >= 0.01 ether && amount <= 100 ether);
vm.deal(client, amount + 1 ether);
vm.prank(client);
escrow.deposit{value: amount}(provider);
assertEq(escrow.getBalance(provider), amount);
vm.prank(owner);
escrow.release(provider, client);
assertEq(escrow.getBalance(provider), 0);
}
}