@hyperlane-xyz/core 5.2.1-beta.0 → 5.3.0
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/middleware/README.md +2 -2
- package/contracts/token/HypNative.sol +24 -0
- package/contracts/token/README.md +3 -3
- package/contracts/token/extensions/HypNativeScaled.sol +25 -0
- package/dist/buildArtifact.js +1 -1
- package/dist/buildArtifact.json +1 -1
- package/dist/contracts/index.d.ts +0 -1
- package/dist/contracts/index.d.ts.map +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/index.d.ts +0 -1
- package/dist/factories/contracts/index.d.ts.map +1 -1
- package/dist/factories/contracts/index.js +0 -1
- package/dist/factories/contracts/index.js.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/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/contracts/PackageVersioned.d.ts +0 -50
- package/dist/contracts/PackageVersioned.d.ts.map +0 -1
- package/dist/contracts/PackageVersioned.js +0 -2
- package/dist/contracts/PackageVersioned.js.map +0 -1
- package/dist/factories/contracts/PackageVersioned__factory.d.ts +0 -31
- package/dist/factories/contracts/PackageVersioned__factory.d.ts.map +0 -1
- package/dist/factories/contracts/PackageVersioned__factory.js +0 -52
- package/dist/factories/contracts/PackageVersioned__factory.js.map +0 -1
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
## Interchain Accounts
|
|
4
4
|
|
|
5
5
|
An interchain account is a smart contract that is deployed on a remote chain controlled exclusively by the origin chain's deployer account.
|
|
6
|
-
Interchain accounts provide developers with a [transparent multicall API](
|
|
6
|
+
Interchain accounts provide developers with a [transparent multicall API](libs/OwnableMulticall.sol) to remote smart contracts.
|
|
7
7
|
This avoids the need to deploy application specific smart contracts on remote chains while simultaneously enabling cross-chain composability.
|
|
8
8
|
|
|
9
9
|
See [IBC Interchain Accounts](https://github.com/cosmos/ibc/blob/main/spec/app/ics-027-interchain-accounts/README.md) for the Cosmos ecosystem equivalent.
|
|
10
10
|
|
|
11
11
|
## Interchain Query System
|
|
12
12
|
|
|
13
|
-
The interchain query system generalizes view calls to contracts on remote chains. It is a [transparent multicall API](
|
|
13
|
+
The interchain query system generalizes view calls to contracts on remote chains. It is a [transparent multicall API](libs/OwnableMulticall.sol) that can be used to query remote smart contracts. This avoids the need to deploy application specific smart contracts on remote chains while simultaneously enabling cross-chain composability.
|
|
14
14
|
|
|
15
15
|
See [IBC Interchain Query System](https://github.com/cosmos/ibc/tree/main/spec/app/ics-031-crosschain-queries) for the Cosmos ecosystem equivalent.
|
|
@@ -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) {
|
|
@@ -45,9 +45,9 @@ graph LR
|
|
|
45
45
|
|
|
46
46
|
The Token Router contract comes in several flavors and a warp route can be composed of a combination of these flavors.
|
|
47
47
|
|
|
48
|
-
- [`Native`](./
|
|
49
|
-
- [`Collateral`](./
|
|
50
|
-
- [`Synthetic`](./
|
|
48
|
+
- [`Native`](./HypNative.sol) - for warping native assets (e.g. ETH) from the canonical chain
|
|
49
|
+
- [`Collateral`](./HypERC20Collateral.sol) - for warping tokens, ERC20 or ERC721, from the canonical chain
|
|
50
|
+
- [`Synthetic`](./HypERC20.sol) - for representing tokens, Native/ERC20 or ERC721, on a non-canonical chain
|
|
51
51
|
|
|
52
52
|
## Interchain Security Models
|
|
53
53
|
|
|
@@ -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
|