Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Refactor and renames #61

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open

Refactor and renames #61

wants to merge 22 commits into from

Conversation

yorhodes
Copy link
Member

@yorhodes yorhodes commented Apr 6, 2023

  • Migrate to unambiguous serialization format
  • Simplify deployers?
  • Rename HypNative => HypNativeCollateral
  • total supply is always 0 when fetched from collateral

@yorhodes yorhodes force-pushed the config-simplification branch from 9a095c8 to 9c6819a Compare April 6, 2023 16:56
Base automatically changed from decimals to main April 6, 2023 17:11
@yorhodes yorhodes marked this pull request as ready for review April 6, 2023 20:33
@yorhodes yorhodes requested review from jmrossy and asaj as code owners April 6, 2023 20:33
@github-actions
Copy link

github-actions bot commented Apr 6, 2023

Hardhat Coverage Report

Coverage after merging config-simplification into main will be
91.67% 0.00%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
contracts
   HypERC20.sol84.62%100%80%87.50%47
   HypERC20Collateral.sol100%100%100%100%
   HypERC721.sol100%100%100%100%
   HypERC721Collateral.sol84.62%100%83.33%85.71%25
   HypNativeCollateral.sol86.67%100%80%87.50%65
contracts/extensions
   HypERC721URICollateral.sol100%100%100%100%
   HypERC721URIStorage.sol85.71%100%83.33%87.50%70
contracts/libs
   Message.sol80%100%80%80%23
   TokenRouter.sol100%100%100%100%

);

const [name, symbol, totalSupply, decimals] = await Promise.all([
erc20.name(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, can we reduce nesting here?

Copy link
Contributor

@asaj asaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving a few comments but IIUC you're in the process of reworking this PR so that the shape of HyperlaneContracts is the same as the factories.

V excited for this, will make hyperlane-deploy much cleaner. And presumably the UI as well

* @author Abacus Works
* @dev Supply on each chain is not constant but the aggregate supply across all chains is.
*/
contract HypNative is TokenRouter {
contract HypNativeCollateral is TokenRouter {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better name

async transfer(
origin: ChainName,
destination: ChainName,
recipient: types.Address,
amount: BigNumberish,
) {
const originRouter = this.getContracts(origin).router;
const originRouter = this.router(this.getContracts(origin));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would really like us to detect the contract type and:

  • approve ERC20Collateral
  • Set msg.value if NativeCollateral

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably best for a follow up PR that covers what we discussed yesterday (i.e. passing chain/tokenType to the app constructor)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another request I'd love to have in that PR is a getBalance(chain) function that will give you the balance of the native asset, collateral asset, or wrapped asset, depending on the chain


async transfer(
origin: ChainName,
destination: ChainName,
recipient: types.Address,
amountOrId: BigNumberish,
) {
const originRouter = this.getContracts(origin).router;
const originRouter = this.router(this.getContracts(origin));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fn does not support native collateral, since value should be gasPayment + amountOrId

export type NativeConfig = {
type: TokenType.native;
type: TokenType.collateral | TokenType.collateralUri | TokenType.native;
token?: string; // no token implies native collateral
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Maybe token not required for native collateral

Just b/c the type is not implied by the presence/absence of token, it's explicit in the type

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants