531 lines
26 KiB
Solidity
531 lines
26 KiB
Solidity
pragma solidity 0.8.20;
|
|
|
|
import {Test} from "forge-std/Test.sol";
|
|
|
|
import {Gatekeeper} from "../../src/Gatekeeper.sol";
|
|
import {FullMath} from "../../src/libraries/FullMath.sol";
|
|
import {Verifier} from "../../src/libraries/Verifier.sol";
|
|
import {RequestPacking} from "../../src/libraries/Packing.sol";
|
|
import {IStorageHistory} from "../../src/interfaces/IStorageHistory.sol";
|
|
import {StorageHistory} from "../../src/types/StorageHistory.sol";
|
|
import {WETH9} from "../../src/mocks/WETH9.sol";
|
|
|
|
contract MockGovernance is Test {
|
|
address public immutable GATEKEEPER;
|
|
address public immutable DUMMY_ADDRESS;
|
|
|
|
bool public auditCalled;
|
|
|
|
enum STATUS {
|
|
RESERVEDEPOSITOR,
|
|
RESERVETOKEN,
|
|
LIQUIDITYDEPOSITOR,
|
|
LIQUIDITYTOKEN,
|
|
REWARDMANAGER
|
|
}
|
|
|
|
constructor(address gatekeeper, address dummyAddress) {
|
|
GATEKEEPER = gatekeeper;
|
|
DUMMY_ADDRESS = dummyAddress;
|
|
auditCalled = false;
|
|
}
|
|
|
|
function setDistributor(address distributor) external view {
|
|
require(msg.sender == GATEKEEPER);
|
|
assertEq(distributor, DUMMY_ADDRESS);
|
|
}
|
|
|
|
function setWarmupPeriod(uint256 warmupPeriod) external view {
|
|
require(msg.sender == GATEKEEPER);
|
|
assertEq(warmupPeriod, 69);
|
|
}
|
|
|
|
function setBounty(uint256 bounty) external view {
|
|
require(msg.sender == GATEKEEPER);
|
|
assertEq(bounty, 69);
|
|
}
|
|
|
|
function setAdjustment(uint256 rate, uint256 target, bool add) external view {
|
|
require(msg.sender == GATEKEEPER);
|
|
assertEq(rate, 69);
|
|
assertEq(target, 420);
|
|
assertEq(add, true);
|
|
}
|
|
|
|
function updateGatekeeperAddress(address gatekeeper) external view {
|
|
require(msg.sender == GATEKEEPER);
|
|
assertEq(gatekeeper, DUMMY_ADDRESS);
|
|
}
|
|
|
|
function addPool(address pool) external view {
|
|
require(msg.sender == GATEKEEPER);
|
|
assertEq(pool, DUMMY_ADDRESS);
|
|
}
|
|
|
|
function removePool(uint256 index) external view {
|
|
require(msg.sender == GATEKEEPER);
|
|
assertEq(index, 1337);
|
|
}
|
|
|
|
function close(uint256 id) external view {
|
|
require(msg.sender == GATEKEEPER);
|
|
assertEq(id, 420);
|
|
}
|
|
|
|
function create(
|
|
uint256[3] calldata market,
|
|
uint256[2] calldata terms,
|
|
address quoteToken,
|
|
uint32[2] calldata intervals,
|
|
bool[2] calldata booleans
|
|
) external view {
|
|
require(msg.sender == GATEKEEPER);
|
|
|
|
assertEq(market[0], 69);
|
|
assertEq(market[1], 420);
|
|
assertEq(market[2], 1337);
|
|
|
|
assertEq(terms[0], 420);
|
|
assertEq(terms[1], 1337);
|
|
|
|
assertEq(quoteToken, DUMMY_ADDRESS);
|
|
|
|
assertEq(intervals[0], 34);
|
|
assertEq(intervals[1], 35);
|
|
|
|
assertEq(booleans[0], true);
|
|
assertEq(booleans[1], true);
|
|
}
|
|
|
|
function enable(STATUS status, address token, address calculator) external view {
|
|
require(msg.sender == GATEKEEPER);
|
|
|
|
if (status != STATUS.RESERVETOKEN) revert();
|
|
assertEq(token, DUMMY_ADDRESS);
|
|
assertEq(calculator, DUMMY_ADDRESS);
|
|
}
|
|
|
|
function disable(STATUS status, address token) external view {
|
|
require(msg.sender == GATEKEEPER);
|
|
|
|
if (status != STATUS.LIQUIDITYTOKEN) revert();
|
|
assertEq(token, DUMMY_ADDRESS);
|
|
}
|
|
|
|
function forfeitReserves(address router, uint256 liquidity, bool destroyerMode) external view {
|
|
require(msg.sender == GATEKEEPER);
|
|
assertEq(router, DUMMY_ADDRESS);
|
|
assertEq(liquidity, 420);
|
|
assertEq(destroyerMode, true);
|
|
}
|
|
|
|
function redeemReserve(address router, uint256 amount) external view {
|
|
require(msg.sender == GATEKEEPER);
|
|
assertEq(router, DUMMY_ADDRESS);
|
|
assertEq(amount, 420);
|
|
}
|
|
|
|
function withdraw(address token, uint256 amount) external view {
|
|
require(msg.sender == GATEKEEPER);
|
|
assertEq(token, DUMMY_ADDRESS);
|
|
assertEq(amount, 420);
|
|
}
|
|
|
|
function auditReserves() external {
|
|
require(msg.sender == GATEKEEPER);
|
|
auditCalled = true;
|
|
}
|
|
}
|
|
|
|
contract MockStaking is Test {
|
|
Gatekeeper public gatekeeper;
|
|
WETH9 public mockReserve;
|
|
|
|
mapping(address => uint256) private _recalledAmounts;
|
|
|
|
constructor() {
|
|
mockReserve = new WETH9();
|
|
StorageHistory history = new StorageHistory();
|
|
gatekeeper = new Gatekeeper(address(history));
|
|
gatekeeper.initialize(address(0));
|
|
history.setOwner(address(gatekeeper));
|
|
}
|
|
|
|
function runGhost(bytes32 receiver, uint256 amount) external {
|
|
gatekeeper.ghost(receiver, amount);
|
|
}
|
|
|
|
function runRecall(
|
|
uint256 exodusSession,
|
|
uint256 amount,
|
|
uint256 packed,
|
|
address caller
|
|
) external {
|
|
vm.prank(address(gatekeeper), caller);
|
|
gatekeeper.recall(exodusSession, amount, packed);
|
|
}
|
|
|
|
function recall(address receiver, uint256 amount) external {
|
|
_recalledAmounts[receiver] += amount;
|
|
}
|
|
|
|
function recall(uint256 amount, uint256, uint256) external returns (address, uint256, uint256){
|
|
_recalledAmounts[tx.origin] += amount;
|
|
return (address(mockReserve), 0, 0);
|
|
}
|
|
|
|
function recalledAmount(address who) external view returns (uint256) {
|
|
return _recalledAmounts[who];
|
|
}
|
|
|
|
function totalReserves() external pure returns (uint256) {
|
|
return type(uint256).max;
|
|
}
|
|
|
|
function baseSupply() external pure returns (uint256) {
|
|
return type(uint256).max;
|
|
}
|
|
}
|
|
|
|
contract GatekeeperTest is Test {
|
|
using RequestPacking for RequestPacking.RequestPayload;
|
|
|
|
address constant ALICE = 0x0000000000000000000000000000000000000001;
|
|
address constant BOB = 0x0000000000000000000000000000000000000002;
|
|
uint256 constant INIT_AMOUNT = 69 * 1e18;
|
|
address constant DUMMY_ADDRESS = address(0x0101010101010101010101010101010101010101);
|
|
|
|
MockGovernance governance;
|
|
Gatekeeper gatekeeper;
|
|
MockStaking staking;
|
|
|
|
event Ghosted(bytes32 indexed receiver, uint256 indexed amount);
|
|
|
|
function setUp() public {
|
|
vm.prank(ALICE, ALICE);
|
|
staking = new MockStaking();
|
|
gatekeeper = staking.gatekeeper();
|
|
|
|
MockGovernance tempGov = new MockGovernance(address(gatekeeper), DUMMY_ADDRESS);
|
|
bytes memory govBytecode = address(tempGov).code;
|
|
|
|
vm.etch(DUMMY_ADDRESS, govBytecode);
|
|
governance = MockGovernance(DUMMY_ADDRESS);
|
|
}
|
|
|
|
function test_correctInitialization() public view {
|
|
assertEq(gatekeeper.staking(), address(staking));
|
|
assertEq(gatekeeper.ghostedSupply(), 0);
|
|
}
|
|
|
|
function test_ghostTokensWork(uint256 ghostAmount) public {
|
|
vm.assume(ghostAmount >= gatekeeper.EXISTENTIAL_DEPOSIT() && ghostAmount < type(uint96).max);
|
|
bytes32 receiver = bytes32(abi.encodePacked(ALICE));
|
|
uint256 ghostedSupply = gatekeeper.ghostedSupply();
|
|
|
|
vm.prank(ALICE);
|
|
staking.runGhost(receiver, ghostAmount);
|
|
assertEq(gatekeeper.ghostedSupply(), ghostedSupply + ghostAmount);
|
|
}
|
|
|
|
function test_couldNotGhostTokensFromArbitraryAddress(address someone) public {
|
|
vm.assume(someone != ALICE);
|
|
bytes32 receiver = bytes32(abi.encodePacked(ALICE));
|
|
|
|
vm.expectRevert();
|
|
vm.prank(someone);
|
|
staking.runGhost(receiver, 69);
|
|
assertEq(gatekeeper.ghostedSupply(), 0);
|
|
}
|
|
|
|
function test_ghostTokensEmitsEvent(uint256 ghostAmount) public {
|
|
vm.assume(ghostAmount >= gatekeeper.EXISTENTIAL_DEPOSIT());
|
|
bytes32 receiver = bytes32(abi.encodePacked(ALICE));
|
|
|
|
vm.expectEmit(true, true, true, false, address(gatekeeper));
|
|
emit Ghosted(receiver, ghostAmount);
|
|
vm.prank(ALICE);
|
|
staking.runGhost(receiver, ghostAmount);
|
|
}
|
|
|
|
function test_recallWork(uint256 exodusSession, uint256 bobAmount, uint32 bobCommission) public {
|
|
vm.assume(bobAmount > gatekeeper.EXISTENTIAL_DEPOSIT() && bobAmount < 1_000 ether);
|
|
vm.assume(bobCommission > 0 && bobCommission <= type(uint32).max);
|
|
|
|
address storageHistory = gatekeeper.storageHistory();
|
|
uint256 commissionAmount = FullMath.mulDiv(bobAmount, uint256(bobCommission), type(uint32).max);
|
|
uint256 bobPacked = RequestPacking.pack(uint32(bobCommission), uint64(block.chainid), BOB);
|
|
|
|
vm.prank(ALICE);
|
|
staking.runGhost(bytes32(abi.encodePacked(ALICE)), bobAmount);
|
|
|
|
uint256 nativeNeeded = FullMath.mulDiv(commissionAmount, staking.totalReserves(), staking.baseSupply());
|
|
|
|
vm.deal(ALICE, nativeNeeded + 1 ether);
|
|
assertEq(BOB.balance, 0 ether);
|
|
|
|
vm.prank(ALICE);
|
|
staking.runRecall(exodusSession, bobAmount, bobPacked, ALICE);
|
|
|
|
assert(IStorageHistory(storageHistory).isTransactionExecuted(exodusSession));
|
|
}
|
|
|
|
function test_rotateWork() public {
|
|
vm.warp(block.timestamp + 1);
|
|
vm.prank(address(gatekeeper));
|
|
gatekeeper.rotate(block.timestamp, 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798, 0);
|
|
|
|
vm.warp(block.timestamp + 1);
|
|
vm.prank(address(gatekeeper));
|
|
gatekeeper.rotate(block.timestamp, 0xF9308A019258C31049344F85F89D5229B531C845836F99B08601F113BCE036F9, 0);
|
|
|
|
vm.warp(block.timestamp + 1);
|
|
vm.prank(address(gatekeeper));
|
|
gatekeeper.rotate(block.timestamp, 0x3590A94E768F8E1815C2F24B4D80A8E3149316C3518CE7B7AD338368D038CA66, 0);
|
|
|
|
vm.warp(block.timestamp + 1);
|
|
vm.prank(address(gatekeeper));
|
|
gatekeeper.rotate(block.timestamp, 0xD4E0D4642DB1613B2C94A81FCD34E39A2A31ACD774CD42525A88CF69EBA2E611, 0);
|
|
}
|
|
|
|
function test_couldNotBridgeBelowExistential(uint256 amount) public {
|
|
vm.assume(amount < gatekeeper.EXISTENTIAL_DEPOSIT());
|
|
bytes32 receiver = bytes32(abi.encodePacked(ALICE));
|
|
|
|
vm.expectRevert();
|
|
vm.prank(ALICE);
|
|
staking.runGhost(receiver, amount);
|
|
|
|
assertEq(gatekeeper.ghostedSupply(), 0);
|
|
}
|
|
|
|
function test_signatureVerificationsWorks() public {
|
|
assertEq(gatekeeper.deployer(), ALICE);
|
|
|
|
vm.prank(ALICE);
|
|
staking.runGhost(bytes32(abi.encodePacked(ALICE)), type(uint104).max);
|
|
|
|
vm.prank(ALICE);
|
|
gatekeeper.updatePublicKeyMetadata(0, 0x36ff5b7f0fc50100b563c6072e499980d6e6aa8528ea0ae6d776cf7e8e96c374, 0);
|
|
|
|
(bytes32 prevPublicKey, uint8 prevParity,) = gatekeeper.latestPublicKeyInfo();
|
|
|
|
// genesis validators 4 validators, DKG #0
|
|
// exodus session #0
|
|
gatekeeper.verify(
|
|
hex"49f03a67000000000000000000000000000000000000000000000000000000000000000036ff5b7f0fc50100b563c6072e499980d6e6aa8528ea0ae6d776cf7e8e96c3740000000000000000000000000000000000000000000000000000000000000000",
|
|
0x58a4ef4e4f9cad19e9bb3707a48f01920ba309f69892609b196bbc112b6aebea,
|
|
0x2de1a8116c65a290c51fee3bac24546c09522423640ae0e38f45791b1d81a069
|
|
);
|
|
|
|
(bytes32 publicKey, uint8 parity, uint64 session) = gatekeeper.latestPublicKeyInfo();
|
|
assertEq(publicKey, prevPublicKey);
|
|
assertEq(parity, prevParity);
|
|
assertEq(session, 0);
|
|
|
|
// could not apply signature from DKG #2
|
|
vm.expectRevert();
|
|
gatekeeper.verify(
|
|
hex"49f03a6700000000000000000000000000000000000000000000000000000000000000135353a4ce3430b37cabb7c495aabfec94895183672738873f4b227bf4ce31fbe50000000000000000000000000000000000000000000000000000000000000000",
|
|
0xd1e4b50b4ff3e9b98ce17b375d6007cf0cf9d65e795cbe682609c1343361a81c,
|
|
0x0cdd6c13658d862e7f816c59ad9cb1b6f5b3b981f019e698f27d1a354dc69cd5
|
|
);
|
|
|
|
// genesis validators 7 validators, DKG #1
|
|
// exodus session #11
|
|
gatekeeper.verify(
|
|
hex"49f03a67000000000000000000000000000000000000000000000000000000000000000bb5cd0d028a5e1b6a4eecb113b7e49c8176385eb77c8f134bc1db4bddd7654de60000000000000000000000000000000000000000000000000000000000000000",
|
|
0x993fc0c870e1010f4933cbdb17b4539aea07234ff787eb3185d03ef8c0d2787e,
|
|
0x4bfe369753a3125a37d13db08ea9125fe2280b70aa47e5890bf9401c785bdb92
|
|
);
|
|
|
|
(publicKey, parity, session) = gatekeeper.latestPublicKeyInfo();
|
|
assert(publicKey != prevPublicKey);
|
|
assertEq(parity, prevParity);
|
|
assertEq(session, 11);
|
|
|
|
prevPublicKey = publicKey;
|
|
prevParity = parity;
|
|
|
|
// genesis validators 5 validators, DKG #2
|
|
// exodus session #19
|
|
gatekeeper.verify(
|
|
hex"49f03a6700000000000000000000000000000000000000000000000000000000000000135353a4ce3430b37cabb7c495aabfec94895183672738873f4b227bf4ce31fbe50000000000000000000000000000000000000000000000000000000000000000",
|
|
0xd1e4b50b4ff3e9b98ce17b375d6007cf0cf9d65e795cbe682609c1343361a81c,
|
|
0x0cdd6c13658d862e7f816c59ad9cb1b6f5b3b981f019e698f27d1a354dc69cd5
|
|
);
|
|
|
|
(publicKey, parity, session) = gatekeeper.latestPublicKeyInfo();
|
|
assert(publicKey != prevPublicKey);
|
|
assertEq(parity, prevParity);
|
|
assertEq(session, 19);
|
|
|
|
uint256 aliceAmountBefore = staking.recalledAmount(ALICE);
|
|
uint256 bobAmountBefore = staking.recalledAmount(BOB);
|
|
uint256 aliceBalanceBefore = ALICE.balance;
|
|
uint256 bobBalanceBefore = BOB.balance;
|
|
|
|
// execute bridge out, happened on DKG #1
|
|
// amount: 34; commission: 0%; ALICE
|
|
// exodus session #1
|
|
vm.prank(ALICE, ALICE);
|
|
gatekeeper.verify(
|
|
hex"bf06188a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000010000000000007a6900000000",
|
|
0x74e1ee0256e3a1f6c38744fff8d72ffb905d660679e69c76b0af2e75db9fbfcc,
|
|
0x4c512ab429d8c38a199daaa7f2c3d74956d2ff435871b160946b69804a1e5d54
|
|
);
|
|
|
|
assertEq(aliceAmountBefore + 34, staking.recalledAmount(ALICE));
|
|
assertEq(bobAmountBefore, staking.recalledAmount(BOB));
|
|
assertEq(aliceBalanceBefore, ALICE.balance);
|
|
assertEq(bobBalanceBefore, BOB.balance);
|
|
|
|
vm.deal(ALICE, 220);
|
|
|
|
aliceAmountBefore = staking.recalledAmount(ALICE);
|
|
bobAmountBefore = staking.recalledAmount(BOB);
|
|
aliceBalanceBefore = ALICE.balance;
|
|
bobBalanceBefore = BOB.balance;
|
|
|
|
// TODO: revisit
|
|
// execute bridge out, happened on DKG #2
|
|
// amount: 210; commission: 50%; BOB
|
|
// exodus session #12
|
|
vm.prank(ALICE, ALICE);
|
|
gatekeeper.verify(
|
|
hex"bf06188a000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000020000000000007a6980000000",
|
|
0x99c5f02bf312fc6b1a125b83397aa87df369738f85275bc42d249660abb1f0e1,
|
|
0x8326ee3fc1cbb1421e2c974d6cc7cb2bfdc9c4f6ebfd403363f6b3a3bc8e9bef
|
|
);
|
|
|
|
assertApproxEqAbs(aliceAmountBefore + 105, staking.recalledAmount(ALICE), 1);
|
|
assertApproxEqAbs(bobAmountBefore + 105, staking.recalledAmount(BOB), 1);
|
|
|
|
// execute setDistributor, exodusSession: 2
|
|
vm.prank(ALICE);
|
|
gatekeeper.verify(
|
|
hex"3137142600000000000000000000000000000000000000000000000000000000000000020000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002475619ab5000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
|
|
0x45a9889cb48e0eca44c3add96dc68d6ab728c1a7e4eab14323f0dcfe67472c1f,
|
|
0x40e6980e96efc0fc6acf47aa0cd665bc5d85a01b909fc4d960948c76f45723b4
|
|
);
|
|
|
|
// execute setWarmupPeriod, exodusSession: 3
|
|
vm.prank(ALICE);
|
|
gatekeeper.verify(
|
|
hex"3137142600000000000000000000000000000000000000000000000000000000000000030000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024a85667c5000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000",
|
|
0x356ef46cfd654b0b609bdff33147df25c20ff9ca7ac3334c57f12e99b6248112,
|
|
0xa6363286f97c02a39aa5280d74f8dc02dabd078911eef60e4848b7d5deeb325b
|
|
);
|
|
|
|
// execute setBounty, exodusSession: 4
|
|
vm.prank(ALICE);
|
|
gatekeeper.verify(
|
|
hex"3137142600000000000000000000000000000000000000000000000000000000000000040000000000007a69010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000245d87d363000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000",
|
|
0xe6a419a5314afed1ff25df0cbf76f2002bfa9d7746817670f2487be5d7774118,
|
|
0x7ce4c7207efdfdb9c71b26c7dd071572544fb27a329b348379d70b2e7a5f21fc
|
|
);
|
|
|
|
// execute setAdjustment, exodusSession: 5
|
|
vm.prank(ALICE);
|
|
gatekeeper.verify(
|
|
hex"3137142600000000000000000000000000000000000000000000000000000000000000050000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000006446d36ab5000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000001a4000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
|
|
0x649a51e565d154f549e24aaf400ed9a2bb8812ed87eeac36372f36ac8cd6aa34,
|
|
0xc9decb2fa41d9217f9a609d568f86bf92b66d6a91ed3c34031025d3845e34b09
|
|
);
|
|
|
|
// execute updateGatekeeperAddress, exodusSession: 6
|
|
vm.prank(ALICE);
|
|
gatekeeper.verify(
|
|
hex"3137142600000000000000000000000000000000000000000000000000000000000000060000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002484f157cd000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
|
|
0xb445285e36eb120a47bd995ce7ecc07f73bf1ec99b5024ef14e87aa1bffd8b39,
|
|
0x8f7241cd388505b0f964dd54243c968559ba603400ee71dea0738a9084f5cf50
|
|
);
|
|
|
|
// execute addPool, exodusSession: 7
|
|
vm.prank(ALICE);
|
|
gatekeeper.verify(
|
|
hex"3137142600000000000000000000000000000000000000000000000000000000000000070000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024d914cd4b000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
|
|
0x83cdbf2cee6f13d60c2261feed4d0643e847cfba6af316722538281c9cb433c8,
|
|
0xdd0c8c1d6d154c951a4171ff9a40084afbfe5f7b3c70c0521e5b6605310e77cb
|
|
);
|
|
|
|
// execute removePool, exodusSession: 8
|
|
vm.prank(ALICE);
|
|
gatekeeper.verify(
|
|
hex"3137142600000000000000000000000000000000000000000000000000000000000000080000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024a38dcbd0000000000000000000000000000000000000000000000000000000000000053900000000000000000000000000000000000000000000000000000000",
|
|
0x622a8a5d57b10682a90e1b92f797375a6bcbb78f30c45877ea570091af1b2831,
|
|
0xd72cd8354a7be788b801e19994a8155f3938ef58005095b398bc96cd2dc77166
|
|
);
|
|
|
|
// execute close, exodusSession: 9
|
|
vm.prank(ALICE);
|
|
gatekeeper.verify(
|
|
hex"3137142600000000000000000000000000000000000000000000000000000000000000090000000000007a69010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000240aebeb4e00000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000",
|
|
0x0ad9c560affebaea5c589fe831033bac2d9c828aacf58559bbf5b2d00f7842b2,
|
|
0x10121ffe0cc95cf3cbb4e92d72d61feec3e94045185cd7f3c5ce0d01e3a644ea
|
|
);
|
|
|
|
// execute close, exodusSession: 10
|
|
vm.prank(ALICE);
|
|
gatekeeper.verify(
|
|
hex"31371426000000000000000000000000000000000000000000000000000000000000000a0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000144a0139f41000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000001a4000000000000000000000000000000000000000000000000000000000000053900000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000000005390000000000000000000000000101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000230000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
|
|
0xb354049d0012ef7ec3edac6aba453daf4bdc2d28fe1d88138f94459799e2343f,
|
|
0x13a6f8b10007b41fa08c8efee85501fac2554571af99fe587b534fe28fdb82a3
|
|
);
|
|
|
|
// execute enable, exodusSession: 13
|
|
vm.prank(ALICE);
|
|
gatekeeper.verify(
|
|
hex"31371426000000000000000000000000000000000000000000000000000000000000000d0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064e4e33ef800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000101010101010101010101010101010101010101000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
|
|
0x0716f763060cfd52339544a203d0e156a42370b0e22d78ea9bf8766b0b66682b,
|
|
0xc2da93948f869c5102992bd1cbd70ef5f821ff522305c69d113faf2e89570ce7
|
|
);
|
|
|
|
// execute disable, exodusSession: 14
|
|
vm.prank(ALICE);
|
|
gatekeeper.verify(
|
|
hex"31371426000000000000000000000000000000000000000000000000000000000000000e0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044529918310000000000000000000000000000000000000000000000000000000000000003000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
|
|
0x7ed91b176c29b73a077e51de0c2a12f6df5e7e04862eb07f9c393f6fc1cd3a8f,
|
|
0x798563362adaade33f39266bb3fa233ac9161ca55d532ca65d5b6d4d0f1edbd2
|
|
);
|
|
|
|
// execute forfeitReserves, exodusSession: 15
|
|
vm.prank(ALICE);
|
|
gatekeeper.verify(
|
|
hex"31371426000000000000000000000000000000000000000000000000000000000000000f0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064f0de236c000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000001a4000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
|
|
0x7f90802deb959f3bea4aa2cda26dad5ec601fc6e45dcd941a19ee9ff57e3f571,
|
|
0xf61bb645ce15a7e4d0a693e0e4defe1f58fa1b113818a083b582fce05ec728f5
|
|
);
|
|
|
|
// execute redeemReserve, exodusSession: 16
|
|
vm.prank(ALICE);
|
|
gatekeeper.verify(
|
|
hex"3137142600000000000000000000000000000000000000000000000000000000000000100000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004482a21577000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000",
|
|
0x197fd53cb6c9c89e8689419c2ea745233487ba7666f896a2469fc5269c785160,
|
|
0x79480d2dfee9c8dcdc2a28a22b3d49ed193c912390c0be655253028fd8ca883d
|
|
);
|
|
|
|
// execute withdraw, exodusSession: 17
|
|
vm.prank(ALICE);
|
|
gatekeeper.verify(
|
|
hex"3137142600000000000000000000000000000000000000000000000000000000000000110000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044f3fef3a3000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000",
|
|
0x53a249b4952662c3a86a810cff1e530ba354761e4091dee9a8997279160b017b,
|
|
0x8042a9b2521d07612ef0fdccaa98ce9561914b20bf75af49310fc36c240073c7
|
|
);
|
|
|
|
// execute auditReserves, exodusSession: 18
|
|
vm.prank(ALICE);
|
|
gatekeeper.verify(
|
|
hex"3137142600000000000000000000000000000000000000000000000000000000000000120000000000007a69010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000042b7ce50000000000000000000000000000000000000000000000000000000000",
|
|
0xf1f4d62d27c3d0388b2298b621b23cd5791e1b97d4423ffc16b14e81ff0df97c,
|
|
0xdbeed3eb94a829710147595c1b10f2ac6ec761c9721d8cc4711842c212ac517e
|
|
);
|
|
|
|
address storageHistory = gatekeeper.storageHistory();
|
|
for (uint256 exodusSession; exodusSession < 19; exodusSession++) {
|
|
assert(IStorageHistory(storageHistory).isTransactionExecuted(exodusSession));
|
|
}
|
|
assert(IStorageHistory(storageHistory).isTransactionExecuted(19));
|
|
}
|
|
}
|