Skip to content

Commit 795d320

Browse files
committed
change OFT token from bytes32 to address
1 parent 1083804 commit 795d320

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

contracts/periphery/counterfactual/CounterfactualDepositOFT.sol

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface ISponsoredOFTSrcPeriphery {
1919
struct OFTImmutables {
2020
uint32 dstEid;
2121
bytes32 destinationHandler;
22-
bytes32 token;
22+
address token;
2323
uint256 maxOftFeeBps;
2424
uint256 executionFee;
2525
uint256 lzReceiveGasLimit;
@@ -77,16 +77,14 @@ contract CounterfactualDepositOFT is CounterfactualDepositBase {
7777
) external payable {
7878
_verifyParams(params);
7979

80-
address inputToken = address(uint160(uint256(params.token)));
81-
8280
// transfer execution fee to execution fee recipient
8381
if (params.executionFee > 0) {
84-
IERC20(inputToken).safeTransfer(executionFeeRecipient, params.executionFee);
82+
IERC20(params.token).safeTransfer(executionFeeRecipient, params.executionFee);
8583
}
8684

8785
uint256 depositAmount = amount - params.executionFee;
8886

89-
IERC20(inputToken).forceApprove(oftSrcPeriphery, depositAmount);
87+
IERC20(params.token).forceApprove(oftSrcPeriphery, depositAmount);
9088

9189
Quote memory quote = Quote({
9290
signedParams: SignedQuoteParams({

contracts/periphery/counterfactual/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Signature verification, nonce tracking, and `cctpDeadline` enforcement are handl
7272
| `srcEid` | Constructor immutable | OFT source endpoint ID for this chain |
7373
| `dstEid` | Route immutable | OFT destination endpoint ID |
7474
| `destinationHandler` | Route immutable | Composer contract on destination (OFT `to` param) |
75-
| `token` | Route immutable | Local token address (the OFT token, as bytes32) |
75+
| `token` | Route immutable | Local token address (the OFT token on source chain) |
7676
| `maxOftFeeBps` | Route immutable | Max OFT bridge fee in bps |
7777
| `executionFee` | Route immutable | Fixed fee paid to relayer |
7878
| `lzReceiveGasLimit` | Route immutable | Gas limit for `lzReceive` on destination |

test/evm/foundry/local/CounterfactualDepositOFT.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ contract CounterfactualOFTDepositTest is Test {
8585
defaultParams = OFTImmutables({
8686
dstEid: DST_EID,
8787
destinationHandler: bytes32(uint256(uint160(makeAddr("composer")))),
88-
token: bytes32(uint256(uint160(address(token)))),
88+
token: address(token),
8989
maxOftFeeBps: 100,
9090
executionFee: 1e6,
9191
lzReceiveGasLimit: 200000,

0 commit comments

Comments
 (0)