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

update token create and token update precompile selectors to match documentation/protobuf #3910

Merged
merged 3 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ private AbiConstants() {
// updateTokenInfo(address token, HederaToken tokenInfo)
public static final int ABI_ID_UPDATE_TOKEN_INFO = 0x2cccc36f;
// updateTokenKeys(address token, TokenKey [])
public static final int ABI_ID_UPDATE_TOKEN_INFO_V2 = 0x18370d34;
// updateTokenKeys(address token, TokenKey [])
public static final int ABI_ID_UPDATE_TOKEN_KEYS = 0x6fc3cbaf;
// getTokenKey(address token, uint tokenType)
public static final int ABI_ID_GET_TOKEN_KEY = 0x3c4dd32e;
Expand All @@ -131,20 +133,38 @@ private AbiConstants() {
// **** HIP-358 function selectors ****
// createFungibleToken(HederaToken memory token, uint initialTotalSupply, uint decimals)
public static final int ABI_ID_CREATE_FUNGIBLE_TOKEN = 0x7812a04b;
// createFungibleToken(HederaToken memory token, uint64 initialTotalSupply, uint32 decimals)
public static final int ABI_ID_CREATE_FUNGIBLE_TOKEN_V2 = 0xc23baeb6;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I like the callout comment you did on the others so suggesting this

Suggested change
public static final int ABI_ID_CREATE_FUNGIBLE_TOKEN_V2 = 0xc23baeb6;
// decimals updated to uint32
public static final int ABI_ID_CREATE_FUNGIBLE_TOKEN_V2 = 0xc23baeb6;

// createFungibleTokenWithCustomFees(
// HederaToken memory token,
// uint initialTotalSupply,
// uint decimals,
// FixedFee[] memory fixedFees,
// FractionalFee[] memory fractionalFees)
public static final int ABI_ID_CREATE_FUNGIBLE_TOKEN_WITH_FEES = 0x4c381ae7;
// createFungibleTokenWithCustomFees(
// HederaToken memory token,
// uint64 initialTotalSupply,
// uint32 decimals,
// FixedFee[] memory fixedFees,
// FractionalFee[] memory fractionalFees)
public static final int ABI_ID_CREATE_FUNGIBLE_TOKEN_WITH_FEES_V2 = 0xb937581a;
// createNonFungibleToken(HederaToken memory token)
public static final int ABI_ID_CREATE_NON_FUNGIBLE_TOKEN = 0x9dc711e0;
// createNonFungibleToken(HederaToken memory token)
// HederaToken field maxSupply updated to int64
public static final int ABI_ID_CREATE_NON_FUNGIBLE_TOKEN_V2 = 0x9c89bb35;
// createNonFungibleTokenWithCustomFees(
// HederaToken memory token,
// FixedFee[] memory fixedFees,
// RoyaltyFee[] memory royaltyFees)
public static final int ABI_ID_CREATE_NON_FUNGIBLE_TOKEN_WITH_FEES = 0x5bc7c0e6;
// createNonFungibleTokenWithCustomFees(
// HederaToken memory token,
// FixedFee[] memory fixedFees,
// RoyaltyFee[] memory royaltyFees)
// HederaToken field maxSupply updated to int64
public static final int ABI_ID_CREATE_NON_FUNGIBLE_TOKEN_WITH_FEES_V2 = 0x45733969;

// **** HIP-514 function selectors ****
// getFungibleTokenInfo(address token)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,15 +519,17 @@ void prepareComputation(final Bytes input, final UnaryOperator<byte[]> aliasReso
syntheticTxnFactory,
infrastructureFactory,
precompilePricingUtils);
case AbiConstants.ABI_ID_UPDATE_TOKEN_INFO -> new TokenUpdatePrecompile(
case AbiConstants.ABI_ID_UPDATE_TOKEN_INFO,
AbiConstants.ABI_ID_UPDATE_TOKEN_INFO_V2 -> new TokenUpdatePrecompile(
ledgers,
updater.aliases(),
decoder,
sigsVerifier,
sideEffectsTracker,
syntheticTxnFactory,
infrastructureFactory,
precompilePricingUtils);
precompilePricingUtils,
functionId);
case AbiConstants.ABI_ID_UPDATE_TOKEN_KEYS -> new TokenUpdateKeysPrecompile(
ledgers,
updater.aliases(),
Expand Down Expand Up @@ -711,8 +713,12 @@ yield switch (nestedFunctionSelector) {
case AbiConstants.ABI_ID_CREATE_FUNGIBLE_TOKEN,
AbiConstants.ABI_ID_CREATE_FUNGIBLE_TOKEN_WITH_FEES,
AbiConstants.ABI_ID_CREATE_NON_FUNGIBLE_TOKEN,
AbiConstants.ABI_ID_CREATE_NON_FUNGIBLE_TOKEN_WITH_FEES,
AbiConstants.ABI_ID_CREATE_FUNGIBLE_TOKEN_V2,
AbiConstants.ABI_ID_CREATE_FUNGIBLE_TOKEN_WITH_FEES_V2,
AbiConstants.ABI_ID_CREATE_NON_FUNGIBLE_TOKEN_V2,
AbiConstants
.ABI_ID_CREATE_NON_FUNGIBLE_TOKEN_WITH_FEES -> (dynamicProperties
.ABI_ID_CREATE_NON_FUNGIBLE_TOKEN_WITH_FEES_V2 -> (dynamicProperties
.isHTSPrecompileCreateEnabled())
? new TokenCreatePrecompile(
ledgers,
Expand Down
Loading