aergo icon indicating copy to clipboard operation
aergo copied to clipboard

Text-Based Transactions

Open kroggen opened this issue 10 months ago • 2 comments

Create a new type of transaction (TEXT) in which the payload contains a text command

Then 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 0.235 ABC to Am23az…

Transfer {amount} {symbol} to {account}

Transfer ARC2 token

Transfer ShowTickets "FISU 2023 A125" to Am23az…

Transfer {contract} {id} to {account}

The rule to differentiate transfer: if first argument is a number -> ARC1, otherwise -> ARC2


Swap ARC1 tokens

Swap 10 ABC for 3.5 DOPS using XSwap
Swap 10 ABC for [at least] 3.5 DOPS using XSwap

Swap {amount} {symbol} for [at least] {amount} {symbol} using {swap-service} [text options...]


Limit Swap orders

Swap 10 ABC for 3.5 DOPS using XSwap Limit-Order

Create Swap Order: 10 ABC for 3.5 DOPS using XSwap

Create Order: Swap 10 ABC for 3.5 DOPS using XSwap

Direct Swap

Create order

Sell 10.1 ABC at 5.3 USDT each
Sell 10.1 ABC for 123.4 USDT
Sell 123.4 USDT for 10.1 ABC

Buy 10.1 ABC with 123.4 USDT
Buy 10.1 ABC at 5.3 USDT each

Swap 10.1 ABC for 123.4 USDT

Create Swap Order: 10 ABC for 3.5 DOPS

Create Order: Swap 10 ABC for 3.5 DOPS

Execute order

Buy 10.1 ABC with 123.4 USDT from Am…

Sell 10.1 ABC at 5.3 USDT each to Am…

Swap 10.1 ABC for 123.4 USDT with Am...

Cancel order

Cancel order 2: Sell 10.1 ABC at 5.3 USDT each
Cancel order 3: Sell 10.1 ABC for 123.4 USDT
Cancel order 4: Sell 123.4 USDT for 10.1 ABC

Cancel order 5: Buy 10.1 ABC with 123.4 USDT
Cancel order 5: Buy 10.1 ABC at 5.3 USDT each

or:

Cancel sale of 10.1 ABC at 5.3 USDT each
Cancel sale of 10.1 ABC for 123.4 USDT
Cancel sale of 123.4 USDT for 10.1 ABC

Cancel buy of 10.1 ABC with 123.4 USDT
Cancel buy of 10.1 ABC at 5.3 USDT each

What if there are many with the same values?

  1. cancel just one
  2. cancel all
  3. cancel by id

Check NFTs

Amounts

  • Always in user readable format, consider as decimal even if there is no dot (add it)
  • Process it either getting the decimals() from the contract or pass the value (with a dot) to the contract

Requirements

  • Only one address per token symbol

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

  • Support update of name/symbol to another address

Maybe use a MultiSig contract for that, or DAO

Notes

How to support different languages? (localization)

  1. Use AI to translate? Is it possible to send a translate request, be processed by many nodes, the result aggregated and signed, but not saved to the blockchain? Only do compute, not storage write. And store on blockchain only the allowed nodes and the logic. Like a transaction that does not save to the chain. but the txn itself is saved (nonce. maybe also paid?) Or just use 3+ diff nodes, each one with known public key, then check the signature of responses
  2. Hardware wallets do not support UTF-8, so why? Only show the translation on screen
  3. Display a simplified command, like "10.1 ABC -> 123.4 USDT" for "Sell 10.1 ABC for 123.4 USDT"
  4. Support many languages, include the lang id on the txn, and let the contract deal with them (server side, native support)

How to handle options, like slippage?

kroggen avatar Sep 23 '23 01:09 kroggen