Skip to content

Utilities and features

Milen Radkov edited this page Dec 29, 2019 · 22 revisions

Allowances

A standard interface allows any tokens to be re-used by other applications: from wallets to decentralized exchanges.

  • The following specification AEX-9 is following the well-known ERC20 standard introduced in Ethereum for creating, handling and interacting with fungible tokens.
  • This standard is proven to be working and we think we can leverage of using it. It will also help us with interoperability and easier developers on-boarding as the main differences will be Sophia syntax related.

The following standard allows for the implementation of a standard API for tokens within smart contracts. This standard provides basic functionality to transfer tokens, as well as allow tokens to be approved so they can be spent by another on-chain third party.

There are several implementations available at the moment, which are still in develop progress but the preferred one and used is this one.

After deploying the token contract in order to do calls, and in generally to interact with Sophia Smart Contracts we use @aeternity/aepp-sdk/es/ae/universal

Main functions in Waellet that are used are:

  • create_allowance for creating allowance for for_account
  • transfer_allowance for transferring tokens from from_account for for_account
  • allowance for getting the allowed spendable amount from from_account for for_account
  • allowances for getting all allowances for the current smart contract. Тo select the fungible token, that user wants to interact with in Create and Transfer is also required field.

Fungible tokens

This feature allows the user to add custom tokens and deploy their own Fungible tokens

Add Fungible Token

To add Fungible Token you need to specify - address of deployed Fungible token contract, token symbol and token precision. When address is entered method meta_info from the contract is called. If response is return the entered address is valid Fungible token contract and the user can add this token. This feature use @aeternity/aepp-sdk/es/ae/universal to interact with Sophia Smart Contracts

this.sdk.contractCallStatic(FUNGIBLE_TOKEN_CONTRACT,address,'meta_info')

Deploy Fungible token contract

This feature allows the user to deploy a fungible token smart contract. Name, symbol and decimals (precision) parameters are required to deploy a new token. After entering the required values contract create transaction is being made which deploys the contract to the selected Aeternity network. After deployment, the token is added in the list of user's available tokens.

We use @aeternity/aepp-sdk/es/ae/universal for contract deployments on aeternity.

waellet_1 waellet_2 waellet_3 waellet_4 waellet_5 waellet_6 waellet_7 waellet_8 waellet_9

Tip website

This feature allows the user to send a given amount of tokens to the website owner. When the tip page is opened the URL of the visited page is passed to the claim method of the Waellet Tipping Contract. Sending the selected tip is also a call to the Waellet Tipping Contract

Clone this wiki locally