Skip to content

Commit

Permalink
Add more response codes esp for HIP-17 and HIP-18 (#57)
Browse files Browse the repository at this point in the history
* Add more response codes esp for HIP-17 and HIP-18

Signed-off-by: tinker-michaelj <[email protected]>

* Add sub-types needed for custom-fee variants of TokenCreate and CryptoTransfer

Signed-off-by: tinker-michaelj <[email protected]>
  • Loading branch information
Michael Tinker authored Jul 16, 2021
1 parent f2c2057 commit 71ae96e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
19 changes: 14 additions & 5 deletions services/BasicTypes.proto
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,22 @@ enum TokenType {
}

/**
* Possible FeeData Object SubTypes. Supplementary to the main HederaFunctionality Type.
* When not explicitly specified, DEFAULT is used.
* Allows a set of resource prices to be scoped to a certain type of a HAPI operation.
*
* For example, the resource prices for a TokenMint operation are different between
* minting fungible and non-fungible tokens. This enum allows us to "mark" a set of
* prices as applying to one or the other.
*
* Similarly, the resource prices for a basic TokenCreate without a custom fee schedule
* yield a total price of $1. The resource prices for a TokenCreate with a custom fee
* schedule are different and yield a total base price of $2.
*/
enum SubType {
DEFAULT = 0;
TOKEN_FUNGIBLE_COMMON = 1;
TOKEN_NON_FUNGIBLE_UNIQUE = 2;
DEFAULT = 0; // The resource prices have no special scope
TOKEN_FUNGIBLE_COMMON = 1; // The resource prices are scoped to an operation on a fungible common token
TOKEN_NON_FUNGIBLE_UNIQUE = 2; // The resource prices are scoped to an operation on a non-fungible unique token
TOKEN_FUNGIBLE_COMMON_WITH_CUSTOM_FEES = 3; // The resource prices are scoped to an operation on a fungible common token with a custom fee schedule
TOKEN_NON_FUNGIBLE_UNIQUE_WITH_CUSTOM_FEES = 4; // The resource prices are scoped to an operation on a non-fungible unique token with a custom fee schedule
}

/**
Expand Down
2 changes: 1 addition & 1 deletion services/CustomFees.proto
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ message FractionalFee {
that transfers units of the token to which this fixed fee is attached. */
message FixedFee {
int64 amount = 1; // The number of units to assess as a fee
TokenID denominating_token_id = 2; // The denomination of the fee; taken as hbar if left unset
TokenID denominating_token_id = 2; // The denomination of the fee; taken as hbar if left unset and, in a TokenCreate, taken as the id of the newly created token if set to the sentinel value of 0.0.0
}

/* A transfer fee to assess during a CryptoTransfer that transfers units of the token
Expand Down
6 changes: 5 additions & 1 deletion services/ResponseCode.proto
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ enum ResponseCodeEnum {
INVALID_QUERY_RANGE = 229; // The range of data to be gathered is out of the set boundaries
FRACTION_DIVIDES_BY_ZERO = 230; // A custom fractional fee set a denominator of zero
INSUFFICIENT_PAYER_BALANCE_FOR_CUSTOM_FEE = 231; // The transaction payer could not afford a custom fee
CUSTOM_FEES_LIST_TOO_LONG = 232; // The customFees list is longer than allowed limit 10
CUSTOM_FEES_LIST_TOO_LONG = 232; // More than 10 custom fees were specified
INVALID_CUSTOM_FEE_COLLECTOR = 233; // Any of the feeCollector accounts for customFees is invalid
INVALID_TOKEN_ID_IN_CUSTOM_FEES = 234; // Any of the token Ids in customFees is invalid
TOKEN_NOT_ASSOCIATED_TO_FEE_COLLECTOR = 235; // Any of the token Ids in customFees are not associated to feeCollector
Expand All @@ -264,4 +264,8 @@ enum ResponseCodeEnum {
TREASURY_MUST_OWN_BURNED_NFT = 252; // A NFT can only be burned when owned by the unique token's treasury
ACCOUNT_DOES_NOT_OWN_WIPED_NFT = 253; // An account did not own the NFT to be wiped
ACCOUNT_AMOUNT_TRANSFERS_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON = 254; // An AccountAmount token transfers list referenced a token type other than FUNGIBLE_COMMON
MAX_NFTS_IN_PRICE_REGIME_HAVE_BEEN_MINTED = 255; // All the NFTs allowed in the current price regime have already been minted
PAYER_ACCOUNT_DELETED = 256; // The payer account has been marked as deleted
CUSTOM_FEE_CHARGING_EXCEEDED_MAX_RECURSION_DEPTH = 257; // The reference chain of custom fees for a transferred token exceeded the maximum length of 2
CUSTOM_FEE_CHARGING_EXCEEDED_MAX_ACCOUNT_AMOUNTS = 258; // More than 20 balance adjustments were to satisfy a CryptoTransfer and its implied custom fee payments
}

0 comments on commit 71ae96e

Please sign in to comment.