33 lines
990 B
Solidity
33 lines
990 B
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity 0.8.35;
|
|
|
|
import {BankV2} from "../../src/BankV2.sol";
|
|
import {MockUSDC} from "../../src/MockUSDC.sol";
|
|
import {BankHandler} from "./BankHandler.sol";
|
|
|
|
contract BankV2Handler is BankHandler {
|
|
BankV2 internal immutable bankV2;
|
|
|
|
uint256 public ghostTransferred;
|
|
|
|
constructor(MockUSDC token_, BankV2 bank_) BankHandler(token_, bank_) {
|
|
bankV2 = bank_;
|
|
}
|
|
|
|
function transfer(uint256 fromSeed, uint256 toSeed, uint256 amount) external {
|
|
uint256 count = actorCount();
|
|
uint256 fromIndex = fromSeed % count;
|
|
address from = actorAt(fromIndex);
|
|
uint256 balance = bankV2.balanceOf(from);
|
|
if (balance == 0) return;
|
|
|
|
uint256 toIndex = (fromIndex + 1 + (toSeed % (count - 1))) % count;
|
|
address to = actorAt(toIndex);
|
|
amount = bound(amount, 1, balance);
|
|
|
|
vm.prank(from);
|
|
bankV2.transferBalance(to, amount);
|
|
ghostTransferred += amount;
|
|
}
|
|
}
|