Docs - SliceLedger
  • What is Slice Ledger?
  • SliceLedger Key Features
  • SliceLedger Wallet
    • SliceLedger Crypto Wallet
      • Slice Web Extension
    • SliceLedger Explorer
    • SliceLedger DEX
    • SliceLedger NFT Market
  • Sliceledger Chain Network
    • Sliceledger Chain Mainnet
    • Sliceledger Chain Testnet
    • CLI Commands
    • Audit
    • Slice Faucet
  • Integrating Metamask
    • Add SliceLedger Chain Network to Metamask
    • Config Custom Token
    • How to Reset Metamask Wallet
  • Slice Ledger Protocols
    • SLICE Game
    • SLICE Reward
    • SLICE Privacy
  • SliceLedger Exclusive Products
    • Bharat NFT Marketplace
    • Bharat Token
    • Slice Crypto Wallet
    • Slice Wallet Extension
    • Bouquet NFT Collection
  • Enterprise Blockchain
    • Diamond Industry
  • SLICE Token
    • Technical
    • Utility
    • Coin Distribution
  • Developer Guide
    • Token Standards
      • SLICE-20 Tokens
      • SLICE-721 Tokens
    • Verify Smart Contract
  • Masternode
    • Masternode Requirements
    • Masternode Setup Guide
    • Run a Full SliceLedger Node
    • Apply For SliceLedger Masternode
    • Resign as Masternode
  • API
    • accounts
    • blockNumber
    • call
    • chainId
    • estimateGas
    • gasPrice
    • getBalance
    • getBlockByHash
    • getBlockByNumber
    • getBlockTransactionCountByHash
    • getBlockTransactionCountByNumber
    • getCode
    • getLogs
    • getStorageAt
    • getTransactionByBlockHashAndIndex
    • getTransactionByBlockNumberAndIndex
    • getTransactionByHash
    • getTransactionCount
    • getTransactionReceipt
    • getUncleByBlockHashAndIndex
    • getUncleByBlockNumberAndIndex
    • getUncleCountByBlockHash
    • getUncleCountByBlockNumber
    • getWork
    • hashrate
    • mining
    • protocolVersion
    • sendRawTransaction
    • submitWork
    • syncing
    • net_listening
    • net_peerCount
    • net_version
    • web3_clientVersion
    • parity_nextNonce
    • Filter methods
    • newFilter
    • newBlockFilter
    • getFilterChanges
    • uninstallFilter
  • Deploying on SliceLedger Chain
    • Using Remix
    • Using Truffle
    • Using Hardhat
Powered by GitBook
On this page
  • SLICE20 Contract Interface
  • Init Web3 Provider
  • Unlock Wallet
  • Init Web3 SLICE20 Contract
  • Check Balance
  • Estimate TX Fee (gas)
  • Token Transfer
  1. Developer Guide
  2. Token Standards

SLICE-20 Tokens

SLICE-20 Tokens on SliceLedger Chain

PreviousToken StandardsNextSLICE-721 Tokens

Last updated 2 years ago

This token standard is equivalent of ERC20 built on top of the SliceLedger Chain network. Users would have to need SLICE in order to cover the transaction fees for sending SLICE-20 tokens. These tokens can be easily integrated into other dapps and get listed on cryptocurrency exchanges.

There is a separate smart contract for creating and issuing SLICE -20 tokens for interested parties or developers where all they have to do is enter name, ticker, details and quantity of tokens to mint it within 10 minutes.

SLICE-20 smart contract ABI:

SLICE20 Contract Interface

function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uint balance);
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);

event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);

SliceLedger Chain provides RPC APIs to developers for using Web3 library to call functions directly in a smart contract. Follow the steps below to interact with the smart contract by using Web3 Library and NodeJS.

Init Web3 Provider

Firstly, init Web3 provider by connecting SliceLedger Chain Fullnode RPC endpoint.

Check SliceLedger Chain Network page to find details about Testnet or Mainnet network information

const Web3 = require('web3')
const web3 = new Web3('https://mainnet-slice-rpc.com')
const chainId = 2020

Unlock Wallet

Refer Create new wallet page for creating/unlocking a new wallet.

Example:

// Unlock wallet by private key
const account = web3.eth.accounts.privateKeyToAccount(pkey)
const holder = account.address
web3.eth.accounts.wallet.add(account)
web.eth.defaultAccount = holder

Init Web3 SLICE20 Contract

const slice20Abi = require('./SRC20abi.json')
const address = '[enter_your_contract_address]'
const slice20 = new web3.eth.Contract(slice20,
        address, {gasPrice: 250000000, gas: 2000000 })

Check Balance

Use call function balanceOf() from SLICE20 contract to check token balance for any address.

Example:

slice20.methods.balanceOf(holder).call()
.then((result) => {
    console.log(result)
}).catch(e => console.log(e))

Estimate TX Fee (gas)

To send tokens, SLICE is needed to cover the transaction fees.

Method:

myContract.methods.myMethod([param1[, param2[, ...]]]).estimateGas(options[, callback])

Example:

slice20.methods.transfer(to, '500000000000000000000').estimateGas({
    from: holder
})
.then((result) => {
    console.log(result)
}).catch(e => console.log(e))

Token Transfer

To transfer SLICE20 token, transfer function is used.

Example:

// send 500000000000000000000 tokens to this address (e.g decimals 18)
const to = "0xdFfD678E4e06d0d56C74EBa4fef50C710c4b5291"
slice20.methods.transfer(to, '500000000000000000000').send({
    from: holder,
    gas: 2000000,
    gasPrice: 250000000,
    chainId: chainId
})
.then((result) => {
    console.log(result)
}).catch(e => console.log(e))
SRC20abi.json