Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: human focus transfer domain #2679

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Conversation

canonbrother
Copy link
Contributor

@canonbrother canonbrother commented Nov 6, 2023

Summary

Requirement
transferdomain <from> <to> <amount> <domain=auto> <domain-specific-opts...> (eg: change-addr=from-for-utxo)

Simplifiy transfer domain command line form

from

transferdomain [{"src":{"address":src,"amount":"1@DFI","domain":3},"dst":{"address":dst,"amount":"1@DFI","domain": 2}}]

to

transferdomain src dst tokenAmount(eg: 1@DFI) domain(0 - auto, 1 - utxo, 2 - dvm, 3 - evm) nonce(optional)
transferdomain src dst tokenAmount domain(eg: 1@DFI) nonce(optional)

RPCs

  • transferdomain

@canonbrother canonbrother force-pushed the canonbrother/td-v2 branch 3 times, most recently from 26eb8f0 to 4bb94d0 Compare November 6, 2023 07:09
@Jouzo
Copy link
Collaborator

Jouzo commented Nov 6, 2023

transferdomain src dst tokenAmount(eg: 1@DFI) nonce(optional)

Are we inferring the domains ?

@canonbrother
Copy link
Contributor Author

canonbrother commented Nov 6, 2023

transferdomain src dst tokenAmount(eg: 1@DFI) nonce(optional)

Are we inferring the domains ?

was removed.. as just found out the domain can be justified via to automatically..
eg: if to == erc55 then domain = evm

@Jouzo
Copy link
Collaborator

Jouzo commented Nov 6, 2023

Shouldn't we add an additional optional domain to be future proof, i.e. for when we add support to UTXO ?

@canonbrother
Copy link
Contributor Author

Shouldn't we add an additional optional domain to be future proof, i.e. for when we add support to UTXO ?

hmm.. yea.. finishing up the basic first.. now impl the utox stuff 😬

@canonbrother canonbrother force-pushed the canonbrother/td-v2 branch 2 times, most recently from 65857b6 to 3e38246 Compare November 7, 2023 02:30
src/dfi/consensus/xvm.h Outdated Show resolved Hide resolved
RPCHelpMan{

if (!request.params[0].isArray()) {
RPCHelpMan{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Help params need to be outside of the if branch and with both help messages in the same unit.
Only the final Check call inside.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure i'm doing it correctly
refined 9e23c23

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

custom made RPCHelpMan 480b080

transferdomain
Creates (and submits to local node and network) a tx to transfer assets across domains. DVM to EVM/EVM to DVM, etc.

Arguments:
1. array | string                       (json array | string, required) A json array of src and dst json objects
    [
    {                        (json object)
        "src": {               (json object) Source arguments
        "address": "str",    (string, required) Source address
        "amount": "str",     (string, required) Amount transfered, the value is amount in amount@token format
        "domain": n,         (numeric, required) Domain of source: 2 - DVM, 3 - EVM
        },
        "dst": {               (json object) Destination arguments
        "address": "str",    (string, required) Destination address
        "amount": "str",     (string, required) Amount transfered, the value is amount in amount@token format
        "domain": n,         (numeric, required) Domain of source: 2 - DVM, 3 - EVM
        },
        "nonce": n,            (numeric) Optional parameter to specify the transaction nonce
    },
    ...
    ]
   from                         (string, required) the source address of sender
2. to                           (string, required) the destination address of sender
3. tokenAmount                  (string, required) in amount@token format
4. nonce

Result:
"hash"                  (string) The hex-encoded hash of broadcasted transaction

Examples:
> defi-cli transferdomain '[{"src":{"address":"<DFI_address>", "amount":"1.0@DFI", "domain": 2}, "dst":{"address":"<ETH_address>", "amount":"1.0@DFI", "domain": 3}}]'
> defi-cli transferdomain '[{"src":{"address":"<ETH_address>", "amount":"1.0@DFI", "domain": 3}, "dst":{"address":"<DFI_address>", "amount":"1.0@DFI", "domain": 2}}]'
> defi-cli transferdomain "from" "to" "100@DFI"
> defi-cli transferdomain "from", "to", 100@BTC 2"

@canonbrother canonbrother force-pushed the canonbrother/td-v2 branch 6 times, most recently from 58af08c to ef1e6f7 Compare November 9, 2023 02:11
@canonbrother
Copy link
Contributor Author

canonbrother commented Nov 9, 2023

removed utxo support
checkpoint at 9e0c557
prefix at src/dst if needed since utxo is not supported

@canonbrother
Copy link
Contributor Author

⚠️ On hold PR.. transferdomain not working due to RPCHelpMan arg checks.. will check again

@prasannavl prasannavl added the e2 Easier effort // fast one for those familiar with codebase label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2 Easier effort // fast one for those familiar with codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants