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

HIP-991: Permissionless revenue-generating Topic IDs for Topic Operators #1082

Open
0xivanov opened this issue Oct 1, 2024 · 0 comments
Open
Labels
enhancement New feature or request
Milestone

Comments

@0xivanov
Copy link
Contributor

0xivanov commented Oct 1, 2024

Updated APIs

TopicCreateTransaction

  • Key feeScheduleKey : The key which allows updates to the new topic’s fees.
    • NOTE: This value can be null.
    • TopicCreateTransaction setFeeScheduleKey(Key)
    • Key getFeeScheduleKey()
  • List<Key> feeExemptKeys : The keys that will be exempt from paying fees.
    • NOTE: This value can be empty.
    • TopicCreateTransaction setFeeExemptKeys(List<Key>)
    • List<Key> getFeeExemptKeys()
  • List<CustomFixedFee> customFees : The fixed fees to assess when a message is submitted to the new topic.
    • NOTE: This value can be empty.
    • TopicCreateTransaction setCustomFees(List<CustomFixedFee>)
    • List<CustomFixedFee> getCustomFees()

TopicUpdateTransaction

  • Key feeScheduleKey : The desired new key which will allow for updates to the topic’s fees.
    • NOTE: This value can be null .
    • TopicUpdateTransaction setFeeScheduleKey(Key)
    • Key getFeeScheduleKey()
  • List<Key> feeExemptKeys : The desired new keys that will be exempt from paying fees.
    • NOTE: This value can be empty.
    • TopicUpdateTransaction setFeeExemptKeys(List<Key>)
    • List<Key> getFeeExemptKeys()
  • List<CustomFixedFee> customFees : The desired new fixed fees to assess when a message is submitted to the topic.
    • NOTE: This value can be empty.
    • TopicUpdateTransaction setCustomFees(List<CustomFixedFee>)
    • List<CustomFixedFee> getCustomFees()

TopicInfo

  • Key feeScheduleKey : The key which will allows for updates to the topic’s fees.
    • NOTE: This value can be null .
  • List<Key> feeExemptKeys : The keys that will are exempt from paying fees.
    • NOTE: This value can be empty.
  • List<CustomFixedFee> customFees : The fixed fees assessed when a message is submitted to the topic.
    • NOTE: This value can be empty.

TopicMessageSubmitTransaction

  • List<CustomFixedFee> customFees : The maximum custom fee that the user is willing to pay for the message.

Test Plan

  1. When a topic is created with a fee schedule key and a custom fixed fee, then the topic has that fee schedule key and that custom fixed fee.
  2. When creating a topic with an invalid fee exempt key list, then the transaction fails with either MAX_ENTRIES_FOR_FEE_EXEMPT_KEY_LIST_EXCEEDED , FEE_EXEMPT_KEY_LIST_CONTAINS_DUPLICATED_KEYS or INVALID_KEY_IN_FEE_EXEMPT_KEY_LIST .
  3. Given a topic, when the topic is updated with a fee schedule key, fee exempt key list, and a custom fixed fee, then the topic has the new fee schedule key, new fee exempt messages key list, and new custom fixed fee.
  4. Given a topic without fee schedule key, when updating the fee schedule key, the transaction fails with FEE_SCHEDULE_KEY_CANNOT_BE_UPDATED.
  5. Given a topic with custom fixed fee but without fee schedule key, when updating the custom fees, the transaction fails with FEE_SCHEDULE_KEY_NOT_SET.
  6. Given an account with an Hbar balance, a topic with a custom fixed fee that charges Hbar, when a message is submitted to that topic and paid for by that account, specifying maximum custom fee amount bigger than topic custom fee amount, then the account is debited the custom fixed fee amount of Hbar.
  7. Given an account with an Hbar balance, a topic with a custom fixed fee that charges Hbar, when a message is submitted to that topic and paid for by that account, without specifying maximum custom fee, then the account is debited the custom fixed fee amount of Hbar.
  8. Given a fungible token, an account with a balance of that token, a topic with a custom fixed fee that charges that token, when a message is submitted to that topic and paid for by that account, specifying maximum custom fee amount bigger than topic custom fee amount, then the account is debited the custom fixed fee amount of the token.
  9. Given a fungible token, an account with a balance of that token, a topic with a custom fixed fee that charges that token, when a message is submitted to that topic and paid for by that account, without specifying maximum custom fee amount, then the account is debited the custom fixed fee amount of the token.
  10. Given an account with an Hbar balance, a topic with a custom fixed fee that charges Hbar and the account’s key in the topic’s fee exempt keys list, when a message is submitted to that topic and paid for by that account, then the account is not debited the custom fixed fee amount of Hbar.
  11. Given a fungible token, an account with a balance of that token, a topic with a custom fixed fee that charges that token and the account’s key in the topic’s fee exempt keys list when a message is submitted to that topic and paid for by that account, then the account is not debited the custom fixed fee amount of the token.
  12. Given an account with an Hbar balance, a topic with a custom fixed fee that charges Hbar, when a message is submitted to that topic and paid for by that account, specifying maximum custom fee amount smaller than topic custom fee amount, then the transaction fails with MAX_CUSTOM_FEE_LIMIT_EXCEEDED .
  13. Given a fungible token, an account with a balance of that token, a topic with a custom fixed fee that charges that token, when a message is submitted to that topic and paid for by that account, specifying maximum custom fee amount smaller than topic custom fee amount, then the transaction fails with MAX_CUSTOM_FEE_LIMIT_EXCEEDED .
  14. Given a fungible token, an account with a balance of that token, a topic with a custom fixed fee that charges that token, when a message is submitted to that topic and paid for by that account, specifying maximum custom fee with invalid tokenID, then the message is not submitted and the transaction fails with NO_VALID_MAX_CUSTOM_FEE.
  15. Given a fungible token, an account with a balance of that token, a topic with a custom fixed fee that charges that token, when a message is submitted to that topic and paid for by that account, specifying maximum custom fee list with duplicate denominations, then the message is not submitted and the transaction fails with DUPLICATE_DENOMINATION_IN_MAX_CUSTOM_FEE_LIST.

SDK Example

  1. Create an account - alice.
  2. Create a topic with an Hbar fee and fee schedule key.
  3. Submit a message to that topic, paid for by alice, specifying max custom fee amount bigger than the topic’s amount.
  4. Verify alice was debited the fee amount and the fee collector account was credited the amount.
  5. Create a fungible token and make the account the treasury.
  6. Update the topic to have a fee of the token.
  7. Submit another message to that topic, paid by alice, without specifying max custom fee amount.
  8. Verify alice was debited the new fee amount and the fee collector account was credited the amount.
  9. Create another account - bob.
  10. Update the topic’s fee exempt keys and add bob’s public key.
  11. Submit another message to that topic, paid with bob, without specifying max custom fee amount.
  12. Verify bob was not debited the fee amount.
@0xivanov 0xivanov added the enhancement New feature or request label Oct 1, 2024
@agadzhalov agadzhalov added this to the v2.53.0 milestone Dec 10, 2024
@SimiHunjan SimiHunjan modified the milestones: v2.53.0, v2.54.0 Jan 9, 2025
@SimiHunjan SimiHunjan modified the milestones: v2.54.0, v2.55.0 Jan 21, 2025
@0xivanov 0xivanov modified the milestones: v2.55.0, v2.56.0 Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants