Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add parachain MultiLocation #1

Merged
merged 2 commits into from
Mar 28, 2023
Merged

add parachain MultiLocation #1

merged 2 commits into from
Mar 28, 2023

Conversation

lana-shanghai
Copy link
Contributor

No description provided.

@lana-shanghai lana-shanghai requested a review from bidzyyys March 27, 2023 14:05
Copy link
Contributor

@bidzyyys bidzyyys left a comment

Choose a reason for hiding this comment

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

Add X1(AccountId32)

);
}

function encodeMultiLocationSameConsensusAccountId32(
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO it should be X1(AccountId32):

Example: /AccountID32(0x234234)

@bidzyyys bidzyyys assigned bidzyyys and lana-shanghai and unassigned bidzyyys Mar 27, 2023
Copy link

@sbp-parity sbp-parity left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@bidzyyys bidzyyys self-requested a review March 28, 2023 14:56
Copy link
Contributor

@bidzyyys bidzyyys left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@bidzyyys bidzyyys merged commit 89b2af4 into main Mar 28, 2023
@bidzyyys bidzyyys deleted the li/add-first-multilocations branch March 28, 2023 14:57
Copy link

@vgeddes vgeddes left a comment

Choose a reason for hiding this comment

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

Looks great! Added a few minor comments.

public pure returns (bytes memory) {
XCMEnums.XcmV3Junctions interiorJunctions = XCMEnums.XcmV3Junctions.X1;
XCMEnums.XcmV3Junction firstJunction = XCMEnums.XcmV3Junction.Parachain;
return abi.encodePacked(
Copy link

Choose a reason for hiding this comment

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

Should rather use byte.concat, which was introduced for this purpose. The former abi.encodePacked is discouraged for concatenating bytes.

BitcoinCore,
BitcoinCash
}
}
Copy link

Choose a reason for hiding this comment

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

needs newline 😄

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.13;

library XCMEnums {
Copy link

Choose a reason for hiding this comment

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

This library is a bit unnecessary. Can define the enums at the toplevel like so:

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.19;

enum XcmV3Junction {
    Parachain,
    AccountId32,
    AccountIndex64,
    AccountKey20,
    PalletInstance,
    GeneralIndex,
    GeneralKey,
    OnlyChild,
    Plurality,
    GlobalConsensus
}

function encodeU8(uint8 input) internal pure returns (bytes1) {
return bytes1(input);
}
}
Copy link

Choose a reason for hiding this comment

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

missing newline


contract MultiLocationEncoder {

function encodeMultiLocationSameConsensusParachain(
Copy link

Choose a reason for hiding this comment

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

Is a fairly verbose function name. Given that name of the contract suggests multilocation encoding, could condense the name to encodeRelativeParachain.

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

Successfully merging this pull request may close these issues.

4 participants