@hyperlane-xyz/core 5.2.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/contracts/token/HypNative.sol +24 -0
- package/contracts/token/extensions/HypNativeScaled.sol +25 -0
- package/dist/buildArtifact.js +1 -1
- package/dist/buildArtifact.json +1 -1
- package/dist/contracts/token/HypNative.d.ts +5 -5
- package/dist/contracts/token/HypNative.d.ts.map +1 -1
- package/dist/contracts/token/extensions/HypNativeScaled.d.ts +5 -5
- package/dist/contracts/token/extensions/HypNativeScaled.d.ts.map +1 -1
- package/dist/factories/contracts/token/HypNative__factory.d.ts +2 -2
- package/dist/factories/contracts/token/HypNative__factory.d.ts.map +1 -1
- package/dist/factories/contracts/token/HypNative__factory.js +2 -2
- package/dist/factories/contracts/token/HypNative__factory.js.map +1 -1
- package/dist/factories/contracts/token/extensions/HypNativeScaled__factory.d.ts +2 -2
- package/dist/factories/contracts/token/extensions/HypNativeScaled__factory.d.ts.map +1 -1
- package/dist/factories/contracts/token/extensions/HypNativeScaled__factory.js +2 -2
- package/dist/factories/contracts/token/extensions/HypNativeScaled__factory.js.map +1 -1
- package/package.json +2 -2
|
@@ -48,6 +48,30 @@ contract HypNative is TokenRouter {
|
|
|
48
48
|
return _transferRemote(_destination, _recipient, _amount, _hookPayment);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* @inheritdoc TokenRouter
|
|
53
|
+
* @dev uses (`msg.value` - `_amount`) as hook payment.
|
|
54
|
+
*/
|
|
55
|
+
function transferRemote(
|
|
56
|
+
uint32 _destination,
|
|
57
|
+
bytes32 _recipient,
|
|
58
|
+
uint256 _amount,
|
|
59
|
+
bytes calldata _hookMetadata,
|
|
60
|
+
address _hook
|
|
61
|
+
) external payable virtual override returns (bytes32 messageId) {
|
|
62
|
+
require(msg.value >= _amount, "Native: amount exceeds msg.value");
|
|
63
|
+
uint256 _hookPayment = msg.value - _amount;
|
|
64
|
+
return
|
|
65
|
+
_transferRemote(
|
|
66
|
+
_destination,
|
|
67
|
+
_recipient,
|
|
68
|
+
_amount,
|
|
69
|
+
_hookPayment,
|
|
70
|
+
_hookMetadata,
|
|
71
|
+
_hook
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
51
75
|
function balanceOf(
|
|
52
76
|
address _account
|
|
53
77
|
) external view override returns (uint256) {
|
|
@@ -38,6 +38,31 @@ contract HypNativeScaled is HypNative {
|
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* @inheritdoc TokenRouter
|
|
43
|
+
* @dev uses (`msg.value` - `_amount`) as hook payment.
|
|
44
|
+
*/
|
|
45
|
+
function transferRemote(
|
|
46
|
+
uint32 _destination,
|
|
47
|
+
bytes32 _recipient,
|
|
48
|
+
uint256 _amount,
|
|
49
|
+
bytes calldata _hookMetadata,
|
|
50
|
+
address _hook
|
|
51
|
+
) external payable override returns (bytes32 messageId) {
|
|
52
|
+
require(msg.value >= _amount, "Native: amount exceeds msg.value");
|
|
53
|
+
uint256 _hookPayment = msg.value - _amount;
|
|
54
|
+
uint256 _scaledAmount = _amount / scale;
|
|
55
|
+
return
|
|
56
|
+
_transferRemote(
|
|
57
|
+
_destination,
|
|
58
|
+
_recipient,
|
|
59
|
+
_scaledAmount,
|
|
60
|
+
_hookPayment,
|
|
61
|
+
_hookMetadata,
|
|
62
|
+
_hook
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
41
66
|
/**
|
|
42
67
|
* @dev Sends scaled `_amount` (multiplied by `scale`) to `_recipient`.
|
|
43
68
|
* @inheritdoc TokenRouter
|