kowala-tech / kcoin

A stable cryptocurrency that algorithmically targets $1 USD using the Kowala Protocol
https://www.kowala.tech/
Other
18 stars 16 forks source link

Improved console minting tools #700

Closed yourheropaul closed 6 years ago

yourheropaul commented 6 years ago

Building on #664, the improves the console minting process.

API

The basic calls are the same as before: one governance key submits a transaction, resulting in a minting ID, and another governance key confirms the transaction by referencing the minting ID.

Transaction submission

Syntax

mtoken.mint(governance_key_address, recipient_address, amount_of_tokens)

Example usage in the console

> mtoken.mint(eth.coinbase, "0x1f1f1480f77b2565ae7f3a5580fd3da79b59b09b", 10); 

This would submit a transaction of 10 mtokens to the address ending b09b. The transaction will not be actioned until it's confirmed by another governance key.

Listing pending and complete transactions

Syntax

mtoken.mintList()

Example usage in the console

> mtoken.mintList()

For which the output might be something like:

[{
    amount: 42,
    confirmed: false,
    id: 0,
    to: "0x1f1f1480f77b2565ae7f3a5580fd3da79b59b09b"
}, {
    amount: 44,
    confirmed: true,
    id: 1,
    to: "0x1f1f1480f77b2565ae7f3a5580fd3da79b59b09b"
}]

The id field is the minting ID, which will be needed in the confirmation step. Once a transaction is submitted, it will appear at the end of this list for verification. The confirmed field indicated whether or not another governance key has confirmed the transaction (and thus actioned it).

Confirming

Syntax

mtoken.confirm(governance_key_address, minting_id)

Example usage

> mtoken.confirm(eth.coinbase, 1)

This would confirm the transaction with minting ID 1, and action it. In the example output above, it would issue 42 tokens to the address ending b09b.

yourheropaul commented 6 years ago

I feel like the implementation of this is a bit ugly, but I don't think there's a better way.

jmatosp commented 6 years ago

Not sure why it's ugly, you mean from solution or code style?

yourheropaul commented 6 years ago

I feel like there's a more canonical way of unpacking the data hashes. But it works, so I guess it's fine.