-
Notifications
You must be signed in to change notification settings - Fork 21
/
DoubleEntryPoint.t.sol
35 lines (26 loc) · 1.05 KB
/
DoubleEntryPoint.t.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "forge-std/Test.sol";
import "./DoubleEntryPointFactory.sol";
contract DoubleEntryPointTest is Test, IDetectionBot {
DoubleEntryPointFactory factory;
address doubleEntryPoint;
address public cryptoVault;
Forta public forta;
function setUp() public {
factory = new DoubleEntryPointFactory();
doubleEntryPoint = factory.createInstance(address(this));
cryptoVault = DoubleEntryPoint(doubleEntryPoint).cryptoVault();
forta = DoubleEntryPoint(doubleEntryPoint).forta();
forta.setDetectionBot(address(this));
}
function handleTransaction(address user, bytes calldata msgData) public override {
(address to, uint256 value, address origSender) = abi.decode(msgData[4:], (address, uint256, address));
if (origSender == cryptoVault) {
forta.raiseAlert(user);
}
}
function testDoubleEntryPoint() public {
assertTrue(factory.validateInstance(payable(doubleEntryPoint), address(this)));
}
}