Skip to content

Commit b2b88a9

Browse files
authored
fix: use 0.8.19 and depositFor in SpokePoolVerifier (#475)
1 parent 297fb4a commit b2b88a9

File tree

2 files changed

+27
-28
lines changed

2 files changed

+27
-28
lines changed

contracts/SpokePoolVerifier.sol

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity ^0.8.0;
33

44
import "@openzeppelin/contracts/utils/Address.sol";
5-
import "./interfaces/V3SpokePoolInterface.sol";
5+
import "./interfaces/SpokePoolInterface.sol";
66

77
/**
88
* @notice SpokePoolVerifier is a contract that verifies that the SpokePool exists on this chain before sending ETH to it.
@@ -22,48 +22,41 @@ contract SpokePoolVerifier {
2222
* This contract should only be used for native token deposits, as this problem only exists for native tokens.
2323
* @param spokePool Address of the SpokePool contract that the user is intending to call.
2424
* @param recipient Address to receive funds at on destination chain.
25-
* @param inputToken Token to lock into this contract to initiate deposit.
26-
* @param outputToken Token to receive on destination chain.
27-
* @param inputAmount Amount of tokens to deposit.
28-
* @param outputAmount Amount of tokens to receive on destination chain.
25+
* @param originToken Token to lock into this contract to initiate deposit.
26+
* @param amount Amount of tokens to deposit. Will be amount of tokens to receive less fees.
2927
* @param destinationChainId Denotes network where user will receive funds from SpokePool by a relayer.
30-
* @param exclusiveRelayer Address of relayer who can fill this deposit before exclusivityDeadline.
31-
* @param fillDeadline Timestamp after which this deposit can no longer be filled.
32-
* @param quoteTimestamp Timestamp used by Across to compute this deposit's fee based on HubPool state. This is
33-
* passed in because this contract is unaware of current timestamp on HubPool chain (i.e. Ethereum).
28+
* @param relayerFeePct % of deposit amount taken out to incentivize a fast relayer.
29+
* @param quoteTimestamp Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid
30+
* to LP pool on HubPool.
3431
* @param message Arbitrary data that can be used to pass additional information to the recipient along with the tokens.
3532
* Note: this is intended to be used to pass along instructions for how a contract should use or allocate the tokens.
33+
* @param maxCount used to protect the depositor from frontrunning to guarantee their quote remains valid.
34+
* Note: this is intended to be used to pass along instructions for how a contract should use or allocate the tokens.
3635
*/
3736
function deposit(
38-
V3SpokePoolInterface spokePool,
37+
SpokePoolInterface spokePool,
3938
address recipient,
40-
address inputToken,
41-
address outputToken,
42-
uint256 inputAmount,
43-
uint256 outputAmount,
39+
address originToken,
40+
uint256 amount,
4441
uint256 destinationChainId,
45-
address exclusiveRelayer,
42+
int64 relayerFeePct,
4643
uint32 quoteTimestamp,
47-
uint32 fillDeadline,
48-
uint32 exclusivityDeadline,
49-
bytes calldata message
44+
bytes memory message,
45+
uint256 maxCount
5046
) external payable {
51-
require(msg.value == inputAmount, "msg.value != amount");
47+
require(msg.value == amount, "msg.value != amount");
5248
require(address(spokePool).isContract(), "spokePool is not a contract");
5349
// Set msg.sender as the depositor so that msg.sender can speed up the deposit.
54-
spokePool.depositV3{ value: msg.value }(
50+
spokePool.depositFor{ value: msg.value }(
5551
msg.sender,
5652
recipient,
57-
inputToken,
58-
outputToken,
59-
inputAmount,
60-
outputAmount,
53+
originToken,
54+
amount,
6155
destinationChainId,
62-
exclusiveRelayer,
56+
relayerFeePct,
6357
quoteTimestamp,
64-
fillDeadline,
65-
exclusivityDeadline,
66-
message
58+
message,
59+
maxCount
6760
);
6861
}
6962
}

hardhat.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ const config: HardhatUserConfig = {
7373
// See https://docs.linea.build/build-on-linea/ethereum-differences#evm-opcodes
7474
version: "0.8.19",
7575
},
76+
"contracts/SpokePoolVerifier.sol": {
77+
...DEFAULT_CONTRACT_COMPILER_SETTINGS,
78+
// NOTE: Linea only supports 0.8.19.
79+
// See https://docs.linea.build/build-on-linea/ethereum-differences#evm-opcodes
80+
version: "0.8.19",
81+
},
7682
},
7783
},
7884
zksolc: {

0 commit comments

Comments
 (0)