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

Improve template of command service gen doc #617

Merged
merged 15 commits into from
Dec 5, 2018
Merged

Conversation

NicolasMahe
Copy link
Member

@NicolasMahe NicolasMahe commented Dec 4, 2018

Closes #270

Example generated from service-ethereum-erc20:


Ethereum ERC20 token

MESG Service to interact with an Ethereum ERC20 token

Contents

Installation

MESG Core

This service requires MESG Core to be install.

You can install MESG Core by running the following command or follow the install guide.

bash <(curl -fsSL https://mesg.com/install)

Service

To deploy this service, run the following command:

mesg-core service deploy https://github.com/mesg-foundation/service-ethereum-erc20

Definitions

Events

Approval

Event key: approval

The approval event of a ERC20. This event happens when an approval occurs

Name Key Type Description
Block number blockNumber Number Block number the associated transaction
Contract address contractAddress String The address of the contract
Owner owner String Address of the owner
Spender spender String Address of the spender
Transaction hash transactionHash String Hash of the transaction
Value value String Value of the approval in token unit

Transfer

Event key: transfer

The transfer event of a ERC20. This event happens when a transfer occurs

Name Key Type Description
Block number blockNumber Number Block number the associated transaction
Contract address contractAddress String The address of the contract
From from String Address of the spender
To to String Address of the receiver
Transaction hash transactionHash String Hash of the transaction
Value value String Value of the approval in token unit

Tasks

Allowance

Task key: allowance

Get the allowance between an owner and a spender

Inputs

Name Key Type Description
Contract address contractAddress String The address of the contract
Owner owner String The address to get the owner
Spender spender String The address to get the spender

Outputs

Error

Output key: error

Output when an error occurs

Name Key Type Description
Message message String The error message

Success

Output key: success

Output when the task executes successfully

Name Key Type Description
Remaining remaining String The remaining balance of the allowance in token unit

Approve

Task key: approve

Authorize a future transfer from

Inputs

Name Key Type Description
Contract address contractAddress String The address of the contract
Gas Limit gasLimit Number optional The maximum gas provided for this transaction
Gas Price gasPrice String optional The gas price in wei to use for this transaction
Signer private key privateKey String The private key to sign the transaction
Spender spender String The address to authorize to transfer to
Value value String The number of token to authorize to transfer in token unit

Outputs

Error

Output key: error

Output when an error occurs

Name Key Type Description
Message message String The error message

Success

Output key: success

Output when the task executes successfully

Name Key Type Description
Transaction hash transactionHash String Hash of the transaction

Balance of

Task key: balanceOf

Get the balance of a given address

Inputs

Name Key Type Description
Address address String The address to get the balance from
Contract address contractAddress String The address of the contract

Outputs

Error

Output key: error

Output when an error occurs

Name Key Type Description
Message message String The error message

Success

Output key: success

Output when the task executes successfully

Name Key Type Description
Balance balance String The balance of the inputted address in token unit

Number of decimals

Task key: decimals

Get the number of decimals of a ERC20

Inputs

Name Key Type Description
Contract address contractAddress String The address of the contract

Outputs

Error

Output key: error

Output when an error occurs

Name Key Type Description
Message message String The error message

Success

Output key: success

Output when the task executes successfully

Name Key Type Description
Number of decimals decimals Number The number of decimals of the ERC20

Token's name

Task key: name

Get the name of a ERC20

Inputs

Name Key Type Description
Contract address contractAddress String The address of the contract

Outputs

Error

Output key: error

Output when an error occurs

Name Key Type Description
Message message String The error message

Success

Output key: success

Output when the task executes successfully

Name Key Type Description
Token's name name String The name of the ERC20

Token's symbol

Task key: symbol

Get the symbol of a ERC20

Inputs

Name Key Type Description
Contract address contractAddress String The address of the contract

Outputs

Error

Output key: error

Output when an error occurs

Name Key Type Description
Message message String The error message

Success

Output key: success

Output when the task executes successfully

Name Key Type Description
Token's symbol symbol String The symbol of the ERC20

Total Supply

Task key: totalSupply

Get the total supply of a ERC20

Inputs

Name Key Type Description
Contract address contractAddress String The address of the contract

Outputs

Error

Output key: error

Output when an error occurs

Name Key Type Description
Message message String The error message

Success

Output key: success

Output when the task executes successfully

Name Key Type Description
Total supply totalSupply String The total supply of the ERC20 in token unit

Transfer

Task key: transfer

Transfer tokens to an address

Inputs

Name Key Type Description
Contract address contractAddress String The address of the contract
Gas Limit gasLimit Number optional The maximum gas provided for this transaction
Gas Price gasPrice String optional The gas price in wei to use for this transaction
Signer private key privateKey String The private key to sign the transaction
To to String The address to transfer the token to
Value value String The number of tokens to transfer in token unit

Outputs

Error

Output key: error

Output when an error occurs

Name Key Type Description
Message message String The error message

Success

Output key: success

Output when the task executes successfully

Name Key Type Description
Transaction hash transactionHash String Hash of the transaction

Transfer From

Task key: transferFrom

Transfer tokens from an approved address

Inputs

Name Key Type Description
Contract address contractAddress String The address of the contract
From from String The address to get the tokens from
Gas Limit gasLimit Number optional The maximum gas provided for this transaction
Gas Price gasPrice String optional The gas price in wei to use for this transaction
Signer private key privateKey String The private key to sign the transaction
To to String The address to transfer the tokens to
Value value String The number of token to transfer in token unit

Outputs

Error

Output key: error

Output when an error occurs

Name Key Type Description
Message message String The error message

Success

Output key: success

Output when the task executes successfully

Name Key Type Description
Transaction hash transactionHash String Hash of the transaction

Co-Authored-By: NicolasMahe <[email protected]>
Co-Authored-By: NicolasMahe <[email protected]>
krhubert
krhubert previously approved these changes Dec 4, 2018
krhubert
krhubert previously approved these changes Dec 4, 2018
antho1404
antho1404 previously approved these changes Dec 5, 2018
Copy link
Member

@antho1404 antho1404 left a comment

Choose a reason for hiding this comment

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

Looks good, and good, I didn’t know about the or

commands/provider/assets/readme_template.md Outdated Show resolved Hide resolved
@NicolasMahe NicolasMahe dismissed stale reviews from antho1404 and krhubert via f4169fc December 5, 2018 05:15
@NicolasMahe NicolasMahe merged commit 156e8a9 into dev Dec 5, 2018
@NicolasMahe NicolasMahe deleted the feature/improve-gen-doc branch December 5, 2018 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants