Skip to content

Commit d9bcdd0

Browse files
committed
update yarn.lock file
Signed-off-by: Ihor Farion <ihor@umaproject.org>
1 parent 088599a commit d9bcdd0

File tree

2 files changed

+4090
-6562
lines changed

2 files changed

+4090
-6562
lines changed

contracts/libraries/OFTTransportAdapter.sol

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ interface IERC20Decimals {
1818
contract OFTTransportAdapter {
1919
using AddressToBytes32 for address;
2020

21+
bytes public constant MSG_EMPTY_PARAM = new bytes(0);
22+
address public constant ZERO_ADDRESS = address(0);
23+
2124
IERC20 public immutable usdt;
2225
IOFT public immutable oftTransport;
2326

@@ -49,8 +52,13 @@ contract OFTTransportAdapter {
4952
return address(oftTransport) != address(0) && address(usdt) == _token;
5053
}
5154

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+
*/
5261
function _transferUsdt(address _to, uint256 amount) internal {
53-
// @dev: building `SendParam` struct
5462
// receiver address converted to bytes32
5563
bytes32 to = _to.toBytes32();
5664

@@ -67,11 +75,19 @@ contract OFTTransportAdapter {
6775
// bytes memory extraOptions = OptionsBuilder.newOptions(); // todo: this requires installing an extra lib `solidity-bytes-utils`
6876
bytes memory extraOptions = new bytes(0);
6977

70-
// todo: can make these an immutable storage var, ZERO_BYTES? Idk
7178
bytes memory composeMsg = new bytes(0);
7279
bytes memory oftCmd = new bytes(0);
7380

74-
SendParam memory sendParam = SendParam(dstEid, to, amountLD, minAmountLD, extraOptions, composeMsg, oftCmd);
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+
);
7591

7692
MessagingFee memory fee = oftTransport.quoteSend(sendParam, false);
7793

@@ -80,7 +96,7 @@ contract OFTTransportAdapter {
8096
(MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt) = oftTransport.send{ value: fee.nativeFee }(
8197
sendParam,
8298
fee,
83-
address(0)
99+
ZERO_ADDRESS
84100
);
85101

86102
// todo: possible further actions:

0 commit comments

Comments
 (0)