From c7409074a67e2546ae57833e0144f0c64b1c23a2 Mon Sep 17 00:00:00 2001 From: Tudor Malene Date: Wed, 14 Aug 2024 12:19:15 +0100 Subject: [PATCH] Create on_tx_hook.md --- design/ux/on_tx_hook.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 design/ux/on_tx_hook.md diff --git a/design/ux/on_tx_hook.md b/design/ux/on_tx_hook.md new file mode 100644 index 0000000000..e1da5c21d1 --- /dev/null +++ b/design/ux/on_tx_hook.md @@ -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. +-