AIXChain Blockchain Document
  • INTRODUCTION
    • Getting started with smart contract development
    • Build a Decentralized Library
  • AIXC AND ARC TOKEN
    • ARC
      • ARX Transfer
      • Query ARX balance
    • ARC-10
      • Issue ARC-10 token
      • Participate ARC-10
      • ARC-10 Transfer
      • Query ARC-10 balance
      • ARC-10 Transfer in Smart Contracts
    • ARC-20
      • Protocol Interface
      • Contract Example
      • Issuing ARC-20 tokens tutorial
    • ARC-721
      • Protocol Interface
      • Contract Example
  • ACCOUNT MODEL
  • BUILD NODE
    • How to setup a Super node to produce Blocks
      • Recommended configuration & Environment
      • Example cloud services
      • Deployment guide
    • Super Representative
      • How to become a SR
      • Super Representatives Election
      • How to change witness name
  • HTTP API
    • Introduction
    • API Signature and Broadcast Flow
    • API List
      • Full Node API Overview
      • Address Utilities
        • GenerateAddress
        • CreateAddress
        • ValidateAddress
      • Accounts
        • CreateAccount
        • GetAccount
        • UpdateAccount
        • AccountPermissionUpdate
        • GetAccountBalance
      • Account Resources
        • GetAccountResource
        • GetAccountNet
        • FreezeBalance
        • UnfreezeBalance
        • GetDelegatedResource
        • GetDelegatedResourceAccountIndex
      • Query the Network
        • GetBlockByNum
        • GetBlockById
        • GetBlockByLatestNum
        • GetBlockByLimitNext
        • GetNowBlock
        • GetTransactionById
        • GetTransactionInfoById
        • GetTransactionInfoByBlockNum
        • ListNodes
        • GetNodeInfo
        • GetChainParameters
        • GetBlockBalance
      • ARC10 Token
        • GetAssetIssueByAccount
        • GetAssetIssueById
        • GetAssetIssueList
        • GetPaginatedAssetIssueList
        • TransferAsset
        • CreateAssetIssue
        • UnfreezeAsset
        • UpdateAsset
      • Transactions
        • GetContract
        • GetTransactionSign
        • BroadcastTransaction
        • BroadcastHex
        • EasyTransfer
        • EasyTransferByPrivate
        • CreateTransaction
      • Voting & SRs
        • ListWitnesses
        • CreateWitness
        • UpdateWitness
        • GetBrokerage
        • UpdateBrokerage
        • VoteWitnessAccount
        • GetReward
        • WithdrawBalance
        • GetNextMaintenanceTime
      • Smart Contracts
        • TriggerSmartContract
        • DeployContract
        • UpdateSetting
        • UpdateEnergyLimit
        • ClearAbi
        • GetContract
        • TriggerConstantContract
      • Proposals
      • Solidity Node API
    • RPC List
  • AIXCHAIN CLI
  • Aixchain SDK
    • Quickstart
    • Address and Signature
    • Sending Transaction
    • Smart Contract
  • Faucet Aixchain
  • Wallets
Powered by GitBook
On this page
  1. AIXC AND ARC TOKEN
  2. ARC-10

ARC-10 Transfer in Smart Contracts

Introduction

Compared to ARC-20 tokens, ARC-10 tokens face a user experience flexibility issue. In Odyssey 3.2, developers and their smart contract callers can interact with ARC-10 token via smart contracts according to the contract logic, do ARC-10 token transfers in smart contracts, giving them more control to implement their token in business scenarios. Unlike ARC-20 tokens, sending ARC-10 tokens is like transferring Aiix in a contract, AIXCHAIN developers added an interface specifically for ARC-10 transfers and queries in solidity.

Example of transferring wrc10 in a contract

Solidity

pragma solidity ^0.5.0;

contract transferTokenContract {
    constructor() payable public{}
    
    function() payable external {}
    
    function transferTokenTest(address payable toAddress, uint256 tokenValue, arcToken id) payable public    {
        toAddress.transferToken(tokenValue, id);
    }
    
    function msgTokenValueAndTokenIdTest() public payable returns(arcToken, uint256){
        acToken id = msg.tokenid;
        uint256 value = msg.tokenvalue;
        return (id, value);
    }
    
    function getTokenBalanceTest(address accountAddress) payable public returns (uint256){
        arcToken id = 1000001;
        return accountAddress.tokenBalance(id);
    }
}

ARC10 token type Odyssey_v3.2 defined a new type (arcToken) for ARC10 token, which represents the tokenId in a token transfer operation. ARC10 token can be converted to uint256 type and vice versa.

arcToken id = 1000001;

ARC10 transfer in contract

address.transferToken(uint256 tokenValue, arcToken tokenId)

Query the ARC10 balance in the contract

address.tokenBalance(arcToken) returns(uint256 tokenAmount)

Odyssey_v3.2 defines a new tokenBalance function for ARC10 token balance query.

TokenValue & TokenID Msg.tokenvalue, represents the token value in the current msg call, with a default value of 0. Msg.tokenid, represents the token id in current msg call, with a default value of 0.

PreviousQuery ARC-10 balanceNextARC-20

Last updated 29 days ago