@@ -18,9 +18,6 @@ interface IERC20Decimals {
18
18
contract OFTTransportAdapter {
19
19
using AddressToBytes32 for address ;
20
20
21
- bytes public constant MSG_EMPTY_PARAM = new bytes (0 );
22
- address public constant ZERO_ADDRESS = address (0 );
23
-
24
21
IERC20 public immutable usdt;
25
22
IOFT public immutable oftTransport;
26
23
@@ -52,13 +49,8 @@ contract OFTTransportAdapter {
52
49
return address (oftTransport) != address (0 ) && address (usdt) == _token;
53
50
}
54
51
55
- /**
56
- * @notice Transfers USDT from the current domain to the given address on the new domain.
57
- * @dev This function will revert if the OFT bridge is disabled. I.e. if the zero address is passed to the constructor for the cctpTokenMessenger.
58
- * @param _to Address to receive USDT on the new domain represented as bytes32.
59
- * @param amount Amount of USDT to transfer.
60
- */
61
52
function _transferUsdt (address _to , uint256 amount ) internal {
53
+ // @dev: building `SendParam` struct
62
54
// receiver address converted to bytes32
63
55
bytes32 to = _to.toBytes32 ();
64
56
@@ -75,19 +67,11 @@ contract OFTTransportAdapter {
75
67
// bytes memory extraOptions = OptionsBuilder.newOptions(); // todo: this requires installing an extra lib `solidity-bytes-utils`
76
68
bytes memory extraOptions = new bytes (0 );
77
69
70
+ // todo: can make these an immutable storage var, ZERO_BYTES? Idk
78
71
bytes memory composeMsg = new bytes (0 );
79
72
bytes memory oftCmd = new bytes (0 );
80
73
81
- // we don't use last 3 params to the `send()` call later, so we set them to zero bytes const, `MSG_EMPTY_PARAM`
82
- SendParam memory sendParam = SendParam (
83
- dstEid,
84
- to,
85
- amountLD,
86
- minAmountLD,
87
- MSG_EMPTY_PARAM,
88
- MSG_EMPTY_PARAM,
89
- MSG_EMPTY_PARAM
90
- );
74
+ SendParam memory sendParam = SendParam (dstEid, to, amountLD, minAmountLD, extraOptions, composeMsg, oftCmd);
91
75
92
76
MessagingFee memory fee = oftTransport.quoteSend (sendParam, false );
93
77
@@ -96,7 +80,7 @@ contract OFTTransportAdapter {
96
80
(MessagingReceipt memory msgReceipt , OFTReceipt memory oftReceipt ) = oftTransport.send { value: fee.nativeFee }(
97
81
sendParam,
98
82
fee,
99
- ZERO_ADDRESS
83
+ address ( 0 )
100
84
);
101
85
102
86
// todo: possible further actions:
0 commit comments