-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v3' into trevor/deploy-kathy-nov-13
- Loading branch information
Showing
100 changed files
with
8,554 additions
and
3,305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity >=0.8.0; | ||
|
||
import {HypERC20} from "./HypERC20.sol"; | ||
|
||
import {TokenRouter} from "./libs/TokenRouter.sol"; | ||
import {FastTokenRouter} from "./libs/FastTokenRouter.sol"; | ||
import {TokenMessage} from "./libs/TokenMessage.sol"; | ||
|
||
import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; | ||
|
||
/** | ||
* @title Hyperlane ERC20 Token Router that extends ERC20 with remote transfer functionality. | ||
* @author Abacus Works | ||
* @dev Supply on each chain is not constant but the aggregate supply across all chains is. | ||
*/ | ||
contract FastHypERC20 is FastTokenRouter, HypERC20 { | ||
constructor( | ||
uint8 __decimals, | ||
address _mailbox | ||
) HypERC20(__decimals, _mailbox) {} | ||
|
||
/** | ||
* @dev delegates transfer logic to `_transferTo`. | ||
* @inheritdoc TokenRouter | ||
*/ | ||
function _handle( | ||
uint32 _origin, | ||
bytes32 _sender, | ||
bytes calldata _message | ||
) internal virtual override(FastTokenRouter, TokenRouter) { | ||
FastTokenRouter._handle(_origin, _sender, _message); | ||
} | ||
|
||
/** | ||
* @dev Mints `_amount` of tokens to `_recipient`. | ||
* @inheritdoc FastTokenRouter | ||
*/ | ||
function _fastTransferTo( | ||
address _recipient, | ||
uint256 _amount | ||
) internal override { | ||
_mint(_recipient, _amount); | ||
} | ||
|
||
/** | ||
* @dev Burns `_amount` of tokens from `_recipient`. | ||
* @inheritdoc FastTokenRouter | ||
*/ | ||
function _fastRecieveFrom( | ||
address _sender, | ||
uint256 _amount | ||
) internal override { | ||
_burn(_sender, _amount); | ||
} | ||
|
||
function balanceOf( | ||
address _account | ||
) public view virtual override(TokenRouter, HypERC20) returns (uint256) { | ||
return HypERC20.balanceOf(_account); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity >=0.8.0; | ||
|
||
import {HypERC20Collateral} from "./HypERC20Collateral.sol"; | ||
import {TokenRouter} from "./libs/TokenRouter.sol"; | ||
import {FastTokenRouter} from "./libs/FastTokenRouter.sol"; | ||
|
||
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; | ||
|
||
/** | ||
* @title Hyperlane ERC20 Token Collateral that wraps an existing ERC20 with remote transfer functionality. | ||
* @author Abacus Works | ||
*/ | ||
contract FastHypERC20Collateral is FastTokenRouter, HypERC20Collateral { | ||
using SafeERC20 for IERC20; | ||
|
||
/** | ||
* @notice Constructor | ||
* @param erc20 Address of the token to keep as collateral | ||
* @param _mailbox Address of the mailbox address | ||
*/ | ||
constructor( | ||
address erc20, | ||
address _mailbox | ||
) HypERC20Collateral(erc20, _mailbox) {} | ||
|
||
/** | ||
* @dev delegates transfer logic to `_transferTo`. | ||
* @inheritdoc FastTokenRouter | ||
*/ | ||
function _handle( | ||
uint32 _origin, | ||
bytes32 _sender, | ||
bytes calldata _message | ||
) internal virtual override(FastTokenRouter, TokenRouter) { | ||
FastTokenRouter._handle(_origin, _sender, _message); | ||
} | ||
|
||
/** | ||
* @dev Transfers `_amount` of `wrappedToken` to `_recipient`. | ||
* @inheritdoc FastTokenRouter | ||
*/ | ||
function _fastTransferTo( | ||
address _recipient, | ||
uint256 _amount | ||
) internal override { | ||
wrappedToken.safeTransfer(_recipient, _amount); | ||
} | ||
|
||
/** | ||
* @dev Transfers in `_amount` of `wrappedToken` from `_recipient`. | ||
* @inheritdoc FastTokenRouter | ||
*/ | ||
function _fastRecieveFrom( | ||
address _sender, | ||
uint256 _amount | ||
) internal override { | ||
wrappedToken.safeTransferFrom(_sender, address(this), _amount); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"rules": { | ||
"no-console": ["off"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.env* | ||
/dist | ||
/cache | ||
/configs | ||
/artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Hyperlane CLI | ||
|
||
The Hyperlane CLI is a command-line tool written in Typescript that facilitates common operations on Hyperlane, such as deploying the core contracts and/or warp routes to new chains. | ||
|
||
## Hyperlane overview | ||
|
||
Hyperlane is an interchain messaging protocol that allows applications to communicate between blockchains. | ||
|
||
Developers can use Hyperlane to share state between blockchains, allowing them to build interchain applications that live natively across multiple chains. | ||
|
||
To read more about interchain applications, how the protocol works, and how to integrate with Hyperlane, please see the [documentation](https://docs.hyperlane.xyz). | ||
|
||
## Setup | ||
|
||
Node 16 or newer is required. | ||
|
||
**Option 1: Global install:** | ||
|
||
```bash | ||
# Install with NPM | ||
npm install -g @hyperlane-xyz/cli | ||
# Or uninstall old versions | ||
npm uninstall -g @hyperlane-xyz/cli | ||
``` | ||
|
||
**Option 2: Temp install:** | ||
|
||
```bash | ||
# Run via NPM's npx command | ||
npx @hyperlane-xyz/cli | ||
# Or via Yarn's dlx command | ||
yarn dlx @hyperlane-xyz/cli | ||
``` | ||
|
||
**Option 3: Run from source:** | ||
|
||
```bash | ||
git clone https://github.com/hyperlane-xyz/hyperlane-monorepo.git | ||
cd hyperlane-monorepo | ||
yarn install && yarn build | ||
cd typescript/cli | ||
yarn hyperlane | ||
``` | ||
|
||
## Common commands | ||
|
||
View help: `hyperlane --help` | ||
|
||
Create a core deployment config: `hyperlane config create` | ||
|
||
Run hyperlane core deployments: `hyperlane deploy core` | ||
|
||
Run warp route deployments: `hyperlane deploy warp` | ||
|
||
View SDK contract addresses: `hyperlane chains addresses` | ||
|
||
Send test message: `hyperlane send message` |
Oops, something went wrong.