5

I want to create a "Bonus Token" that will automatically be sent to an account that pays with this token. If a sender uses the token to pay multiple times per day then they will only receive the "bonus" once for that day.

As an example, let's say that Alice uses the Bonus Token to pay Bob, then the account issuer will automatically send 1 Bonus Token to Alice as a bonus. If Alice sends another token to another address on the same day then Alice will not receive the bonus because she already received a bonus for that day.

7

Sure, it's possible. You'll need to setup your own server with database and pretty straight-forward logic.

  1. Setup listening to All Payments endpoint in streaming mode. In that way you can monitor all transactions on the network 24/7.
  2. Once the payment notification is received, just check the transferred asset. If it's not a "Bonus Token", just ignore the operation.
  3. Query the DB to check whether this account has already received the Bonus today.
  4. If the bonus was not received yet, send the bonus and create the corresponding record in the DB.

Another option is to maintain your own Stellar node with Horizon. In that case you will be able to query the payment history directly. This approach requires advanced SQL skills to implement the logic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.