Introduction

The Fungible tokens base tier serves as the foundational layer for tokenisation within the Overledger ecosystem, offering essential functionalities for managing fungible assets on blockchain networks.

Prerequisites


The tokenisation APIs are divided into two categories: the first includes APIs that write transactions to the blockchain network, altering the network's state. The second category comprises read operations that solely retrieve data from the blockchain.

Write Operations

Write functions (or 'non-view' functions) modify the blockchain state. Since they cause permanent changes in the blockchain, they require a transaction signature for authorisation and cost transaction fees to compensate miners for processing the change. The write operations for the base tier are listed below:

Create Credit

The "Create Credit" enables you to initiate payments to specified accounts using a designated fungible token. You can find the create credit endpoint under our API references Create Credit

To successfully do the create credit function, the following steps are necessary:

Prepare

You can utilise the curl command to prepare your create credit transaction.

curl --location 'https://api.sandbox.overledger.io/v2/preparation/credit' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: authorization' \
--data '{
    "location": {
        "technology": "Ethereum",
        "network": "Ethereum Seploia Testnet"
    },
    "type": "Create Credit",
    "urgency": "normal",
    "message": "OVL Transaction Message",
    "overledgerSigningType": "overledger-javascript-library",
    "requestDetails": {
        "payee": [
            {
                "payment": {
                    "amount": "0.0000001",
                    "unit": "TEST"
                },
                "payeeId": "0x8917cf2A57DF39D311a96c53FCCA76dAFB25392B"
            }
        ],
        "payer": [
            {
                "payerId": "0x08f0C8451eC8283638F35D863DfFD8c1e1b3E39d"
            }
        ]
    }
}'

Sign

Once the transaction is prepared with the specified details (like recipient address, amount, etc.), it is possible to use the private key that was obtained earlier (in the prerequisites) to sign it cryptographically. You can follow the article for signing a transaction here.

Execute

After signing your request, you can proceed to execute it, which will write this transaction onto the network. For detailed instructions on executing your signed request, please refer to the execute signed request API reference.

Create Debit

The "Create Debit" facilitates the creation of payments by withdrawing the approved amount from a designated account. You can find the create debit endpoint under our API references Create Debit

In this context, you must adhere to the prepare, sign, and execute steps outlined in the preceding function.

Approve Debit

The "Approve Debit" grants authorization for someone to initiate a pull payment from your account. You can find the approve debit endpoint under our API references Approve Debit

In this context, you must adhere to the prepare, sign, and execute steps outlined in the preceding function.


Read operations

Read functions, also referred to as 'view' functions, retrieve data from the blockchain without altering its state. These functions do not require signing, do not incur transaction fees, execute on a single node, and importantly, do not modify the blockchain's state. The read operations for the base tier are listed below:

Account Balance

The "Account Balance" enables you to retrieve the balance of QRC20 tokens for a specified account. You can find the account balance endpoint under our API references Account Balance

Current Supply

The "Current Supply" returns the number of QRC tokens that are currently in circulation after tokens have been minted and burned. You can find the current supply endpoint under our API references Current Supply

Approved Account Allowance

The "Approved Account Allowance" returns the number of QRC20 tokens a particular account is allowed to debit from another account. You can find the approved account allowance endpoint under our API references Approved Account Allowance