Open kroggen opened 12 months ago
The command can be processed by:
A. A Lua smart contract running on the user account (similar to composable txns) B. Code in golang that uses a smart contract to read the maps
On the first case, as it is running on the user account it cannot read the token maps, so it must call another contract to read the map of symbol to address
Contracts that support text transactions could export a function with common name, like execute_text_command()
On this case the recipient could be optionally filled (contain the MultiSig wallet address)
If empty, it means the sender's account
The sender must be approved to run the command!
Direct Swap:
The user can have many wallets. The wallet address must be specified on the txn recipient, and displayed on the hardware wallet:
---------------------
Wallet
Am89us4...
---------------------
---------------------
Command
...
---------------------
How to use the text transaction with the "super wallet"?
execute_text_command()
on the contract, using the sender as the senderApprove Proposal: 5
Approve Proposal: Sell 10.1 ABC for 123.4 USDT
Approve Proposal 5: Sell 10.1 ABC for 123.4 USDT
There may be also proposals with:
If the proposal is too long, it can just show the proposal ID.
How the text-processing contract could call the user's account code?
First check if the cmd is recognized. If yes, process it. If not, transfer the text command to the contract via calling the execute_text_command()
on the user's wallet code (check the sender!). It can process commands related to the account, like "Buy", "Sell", "Cancel" (limit orders)
When making the call to the user's account code:
Make a call using the account address as the recipient, set the function name and args... the golang code should load the user's account contract and make the call
Or just do a delegate call (?)
Should it handle Composable Txns? A. many operations on a single txn B. check the amount of received token
Or use templates for this purpose
Maybe the text commands can replace templates for Composable Transactions. Maybe all cases in which templates would be used (common cases) could be replaced by text commands
Should it have separate text commands for Composable Transactions? (different txn type?)
Both these could be supported:
Transfer 0.235 ABC, 3.5 DOPS, ShowTickets "FISU 2023 A125" to Am23az…
Transfer to Am23az…Gs89: 0.235 ABC, 3.5 DOPS, ShowTickets "FISU 2023 A125"
But how would be the interface on the wallet to make multiple transfers?
Check also the method to compose transactions
I think there are additional interesting use-case for text-based transactions
I think both are very interesting side-effects.
BTW Small Lanauge Models such as Phi-2 (https://huggingface.co/spaces/plug/phi-offline?model=phi_2_0_q4k) are compact enough to operate even in the browser and some businesses (such as banks) that used to rely on old-styled chatbots found legitimate use-cases for those models. It will be interesting to support plugging-in compact language models on to Aergo. (Of course direct on-chain storage will be still dificult, but we can figure something out like IPFS or filecoin to do that)
Create a new type of transaction (
TEXT
) in which the payload contains a text commandThen the nodes must process the command via the Aergo engine (Go or smart contract or both)
This makes the transaction simpler to understand when signing on a hardware wallet
Examples
Transfer ARC1 tokens
Transfer ARC2 token
The rule to differentiate transfer: if first argument is a number -> ARC1, otherwise -> ARC2
Swap ARC1 tokens
Limit Swap orders
Direct Swap
Create order
Execute order
Cancel order
What if there are many with the same values?
Check NFTs
Amounts
decimals()
from the contract or pass the value (with a dot) to the contractRequirements
Must keep a store of
symbol
->address
For ARC2 it can be
name
->address
Or maybe also use the name system to resolve symbol -> address
Name of swap contracts should also point to an address
May need to get the address of the pair from the swap factory or router
Maybe use a MultiSig contract for that, or DAO
Notes
How to support different languages? (localization)
How to handle options, like slippage?