@@ -9,6 +9,7 @@ import {Bridge} from "../src/abstract/Bridge.sol";
9
9
import {IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol " ;
10
10
import {WrappedToken} from "../src/WrappedToken.sol " ;
11
11
import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol " ;
12
+ import {EthGetLogsPrecompileHelperTypes} from "pod-sdk/types/EthGetLogsPrecompileHelperTypes.sol " ;
12
13
13
14
contract BridgeMintBurnTest is BridgeBehaviorTest {
14
15
BridgeMintBurn private _bridge;
@@ -49,7 +50,7 @@ contract BridgeMintBurnTest is BridgeBehaviorTest {
49
50
}
50
51
51
52
function test_Claim_SingleLog_MintsToRecipient () public {
52
- BridgeMintBurn .RpcLog[] memory logs = new BridgeMintBurn .RpcLog [](1 );
53
+ EthGetLogsPrecompileHelperTypes .RpcLog[] memory logs = new EthGetLogsPrecompileHelperTypes .RpcLog [](1 );
53
54
logs[0 ] = _makeLog (0 , _mirror, DEPOSIT_AMOUNT, recipient);
54
55
_mockEthGetLogs (0 , bytes ("0x1 " ), _mirror, logs);
55
56
assertEq (_token.balanceOf (recipient), 0 );
@@ -68,15 +69,15 @@ contract BridgeMintBurnTest is BridgeBehaviorTest {
68
69
}
69
70
70
71
function test_Claim_RevertIfDailyLimitExhausted () public {
71
- BridgeMintBurn .RpcLog[] memory logs = new BridgeMintBurn .RpcLog [](1 );
72
+ EthGetLogsPrecompileHelperTypes .RpcLog[] memory logs = new EthGetLogsPrecompileHelperTypes .RpcLog [](1 );
72
73
logs[0 ] = _makeLog (0 , _mirror, tokenLimits.claim + 1 , recipient);
73
74
_mockEthGetLogs (0 , bytes ("0x1 " ), _mirror, logs);
74
75
vm.expectRevert (abi.encodeWithSelector (IBridge.DailyLimitExhausted.selector ));
75
76
_bridge.claim (0 , _mirror, bytes ("0x1 " ));
76
77
}
77
78
78
79
function test_Claim_RevertIfDailyLimitExhausted_ButSucceedAfterOneDay () public {
79
- BridgeMintBurn .RpcLog[] memory logs = new BridgeMintBurn .RpcLog [](1 );
80
+ EthGetLogsPrecompileHelperTypes .RpcLog[] memory logs = new EthGetLogsPrecompileHelperTypes .RpcLog [](1 );
80
81
logs[0 ] = _makeLog (0 , _mirror, DEPOSIT_AMOUNT, recipient);
81
82
_mockEthGetLogs (0 , bytes ("0x1 " ), _mirror, logs);
82
83
_bridge.claim (0 , _mirror, bytes ("0x1 " ));
@@ -90,14 +91,14 @@ contract BridgeMintBurnTest is BridgeBehaviorTest {
90
91
}
91
92
92
93
function test_Claim_RevertIfNoDepositsFound () public {
93
- BridgeMintBurn .RpcLog[] memory logs = new BridgeMintBurn .RpcLog [](0 );
94
+ EthGetLogsPrecompileHelperTypes .RpcLog[] memory logs = new EthGetLogsPrecompileHelperTypes .RpcLog [](0 );
94
95
_mockEthGetLogs (0 , bytes ("0x1 " ), _mirror, logs);
95
96
vm.expectRevert (abi.encodeWithSelector (IBridgeMintBurn.NoDepositsFound.selector ));
96
97
_bridge.claim (0 , _mirror, bytes ("0x1 " ));
97
98
}
98
99
99
100
function test_Claim_RevertIfMultipleDepositsFound () public {
100
- BridgeMintBurn .RpcLog[] memory logs = new BridgeMintBurn .RpcLog [](2 );
101
+ EthGetLogsPrecompileHelperTypes .RpcLog[] memory logs = new EthGetLogsPrecompileHelperTypes .RpcLog [](2 );
101
102
logs[0 ] = _makeLog (0 , _mirror, DEPOSIT_AMOUNT, recipient);
102
103
logs[1 ] = _makeLog (0 , _mirror, DEPOSIT_AMOUNT, recipient);
103
104
_mockEthGetLogs (0 , bytes ("0x1 " ), _mirror, logs);
@@ -108,7 +109,7 @@ contract BridgeMintBurnTest is BridgeBehaviorTest {
108
109
function test_Claim_RevertIfMirrorTokenNotFound () public {
109
110
// Use a token not mapped in mirrorTokens
110
111
address unknownMirror = address (0xBEEF );
111
- BridgeMintBurn .RpcLog[] memory logs = new BridgeMintBurn .RpcLog [](1 );
112
+ EthGetLogsPrecompileHelperTypes .RpcLog[] memory logs = new EthGetLogsPrecompileHelperTypes .RpcLog [](1 );
112
113
logs[0 ] = _makeLog (0 , unknownMirror, DEPOSIT_AMOUNT, recipient);
113
114
_mockEthGetLogs (0 , bytes ("0x1 " ), unknownMirror, logs);
114
115
@@ -117,7 +118,7 @@ contract BridgeMintBurnTest is BridgeBehaviorTest {
117
118
}
118
119
119
120
function test_Claim_RevertIfAlreadyProcessed () public {
120
- BridgeMintBurn .RpcLog[] memory logs = new BridgeMintBurn .RpcLog [](1 );
121
+ EthGetLogsPrecompileHelperTypes .RpcLog[] memory logs = new EthGetLogsPrecompileHelperTypes .RpcLog [](1 );
121
122
logs[0 ] = _makeLog (0 , _mirror, DEPOSIT_AMOUNT, recipient);
122
123
_mockEthGetLogs (0 , bytes ("0x1 " ), _mirror, logs);
123
124
_bridge.claim (0 , _mirror, bytes ("0x1 " ));
@@ -136,7 +137,7 @@ contract BridgeMintBurnTest is BridgeBehaviorTest {
136
137
}
137
138
138
139
function test_Claim_RevertIfPrecompileCallFails () public {
139
- BridgeMintBurn.ExternalEthGetLogsArgs memory args = _buildArgs (0 , bytes ("0x1 " ), _mirror);
140
+ EthGetLogsPrecompileHelperTypes.PrecompileArgs memory args = _buildArgs (0 , bytes ("0x1 " ), _mirror);
140
141
podMockEthGetLogsRevert (abi.encode (args));
141
142
142
143
vm.expectRevert (abi.encodeWithSelector (IBridgeMintBurn.PrecompileCallFailed.selector ));
@@ -171,22 +172,25 @@ contract BridgeMintBurnTest is BridgeBehaviorTest {
171
172
function _buildArgs (uint256 id , bytes memory fromBlock , address tokenAddr )
172
173
internal
173
174
pure
174
- returns (BridgeMintBurn.ExternalEthGetLogsArgs memory )
175
+ returns (EthGetLogsPrecompileHelperTypes.PrecompileArgs memory )
175
176
{
176
- BridgeMintBurn.EthGetLogsArgs memory inner = BridgeMintBurn. EthGetLogsArgs ({
177
+ EthGetLogsPrecompileHelperTypes.RpcArgs memory inner = EthGetLogsPrecompileHelperTypes. RpcArgs ({
177
178
fromBlock: fromBlock,
178
179
toBlock: hex "66696e616c697a6564 " ,
179
180
addr: tokenAddr,
180
181
blockHash: bytes32 (0 ),
181
182
topics: _buildTopics (id, tokenAddr)
182
183
});
183
- return BridgeMintBurn. ExternalEthGetLogsArgs ({chainId: 1 , ethGetLogsArgs: inner});
184
+ return EthGetLogsPrecompileHelperTypes. PrecompileArgs ({chainId: 1 , ethGetLogsArgs: inner});
184
185
}
185
186
186
- function _mockEthGetLogs (uint256 id , bytes memory fromBlock , address tokenAddr , BridgeMintBurn.RpcLog[] memory logs )
187
- internal
188
- {
189
- BridgeMintBurn.ExternalEthGetLogsArgs memory args = _buildArgs (id, fromBlock, tokenAddr);
187
+ function _mockEthGetLogs (
188
+ uint256 id ,
189
+ bytes memory fromBlock ,
190
+ address tokenAddr ,
191
+ EthGetLogsPrecompileTypes.RpcLog[] memory logs
192
+ ) internal {
193
+ EthGetLogsPrecompileTypes.PrecompileArgs memory args = _buildArgs (id, fromBlock, tokenAddr);
190
194
podMockEthGetLogs (abi.encode (args), abi.encode (logs));
191
195
}
192
196
@@ -200,9 +204,9 @@ contract BridgeMintBurnTest is BridgeBehaviorTest {
200
204
function _makeLog (uint256 id , address tokenAddr , uint256 amount , address to )
201
205
internal
202
206
pure
203
- returns (BridgeMintBurn .RpcLog memory )
207
+ returns (EthGetLogsPrecompileTypes .RpcLog memory )
204
208
{
205
- return BridgeMintBurn .RpcLog ({
209
+ return EthGetLogsPrecompileTypes .RpcLog ({
206
210
addr: tokenAddr,
207
211
topics: _buildTopics (id, tokenAddr),
208
212
data: abi.encode (amount, to),
0 commit comments