Skip to content

Commit

Permalink
Create on_tx_hook.md (#2023)
Browse files Browse the repository at this point in the history
  • Loading branch information
tudor-malene authored Aug 15, 2024
1 parent 0d19547 commit 8558a2c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions design/ux/on_tx_hook.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Platform-level traffic incentives

We want a flexible mechanism to incentivise traffic.

For example:
- every transaction is rewarded with a ZEN token
- if you hold over 1000 TEN tokens, you receive two ZEN tokens
- if you use the newly launched app X during the first week, you double your reward
- randomly, tx senders could receive hidden prizes
- every 1000 transactions, you receive 100 ZEN
- etc

## Solution

In the Genesis block, we deploy an upgradeable contract. The address is saved.
This contract will have a method `onTransactions(tx[])` that delegates to a dynamic implementation.

*Note1: The method receives all transactions from the batch.*
*Note2: The `tx` - is a reduced object containing everything except the calldata*


At the end of every batch, our EVM implementation will create a synthetic transaction that calls `onTransactions`.


## Discusson

- the logic should be simple because it will be applied to every transaction, and it will impact performance.
- The implementation can be changed at any time
- The contract should not fail.
-

0 comments on commit 8558a2c

Please sign in to comment.