Search…
Appendix
In this section, we would like to provides commands to request/to query information from smart contracts (BSH, BMV, BMC) on both networks and also some necessary error response codes that might occurs regarding of a failure deployment/request

ICON-BSH

1
# Query all supporting coins
2
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "NativeCoinBSH address" --method coinNames
3
4
# Query coinID of a given '_coinName'
5
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "NativeCoinBSH address" --method coinId --param _coinName="Coin Name"
6
7
# Query current setting of feeRatio
8
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "NativeCoinBSH address" --method feeRatio
9
10
# Query a list of current Owners
11
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "NativeCoinBSH address" --method getOwners
12
13
# Check whether one address has an Ownership role
14
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "NativeCoinBSH address" --method isOwner --param _addr="Address of account being verified"
15
16
# Get total supply of one wrapped coin given by an '_id'
17
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "IRC31Token address" --method totalSupply --param _id="Coin ID"
18
19
# Query a list of current Owners
20
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "IRC31Token address" --method getOwners
21
22
# Check whether one address has an Ownership role
23
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "IRC31Token address" --method isOwner --param _addr="Address of account being verified"
24
25
# Query balance of an account given by '_coinID'
26
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call \
27
--to "IRC31Token address" --method balanceOf \
28
--param _owner="Account Address" --param _id="Coin ID"
29
30
# Query balance of accounts given by a list of '_coinIDs'
31
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call \
32
--to "IRC31Token address" --method balanceOf \
33
--param _addr=Array of Accounts --param _ids=Array of Coin IDs
Copied!

ICON-BMC

1
# Get BTP Address of BMC contract
2
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMC Address" --method getBtpAddress
3
4
# Get registered BMVs
5
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMC Address" --method getVerifiers
6
7
# Get registered BSH Services
8
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMC Address" --method getServices
9
10
# Get registered Links
11
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMC Address" --method getLinks
12
13
# Get registered Routes
14
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMC Address" --method getRoutes
15
16
# Get registered ServiceCandidates
17
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMC Address" --method getServiceCandidates
18
19
# Get status of a given link
20
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMC Address" --method getStatus --param _link="Link"
21
22
# Get registered Relays of a given link
23
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMC Address" --method getRelays --param _link="Link"
24
25
# Get Fee Gathering Term
26
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMC Address" --method getFeeGatheringTerm
27
28
# Get an address of Fee Aggregator
29
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMC Address" --method getFeeAggregator
30
31
# Get a map of Relayers
32
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMC Address" --method getRelayers
33
34
# Get Min Bond of Relayer
35
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMC Address" --method getRelayerMinBond
36
37
# Get Relayer Term
38
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMC Address" --method getRelayerTerm
39
40
# Get Min Bond of Relayer
41
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMC Address" --method getRelayerRewardRank
42
43
# Get Min Bond of Relayer
44
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMC Address" --method getRelayerManagerProperties
Copied!

ICON-BMV

1
# Get connected BMC
2
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMV Address" --method bmc
3
4
# Get Net Address
5
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMV Address" --method netAddress
6
7
# Get setID
8
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMV Address" --method setID
9
10
# Get BMV Status
11
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMV Address" --method getStatus
12
13
# Get address of PARACHAIN Event Decoder
14
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMV Address" --method paraEventDecoder
15
16
# Get address of RELAYCHAIN Event Decoder
17
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon call --to "BMV Address" --method relayEventDecoder
Copied!

MOON-BSH

1
# Attention: These commands should be executed within truffle console and in the directory (../solidity/bsh)
2
truffle console --network moonbeamlocal
3
4
# Below commands working with BSHCore contract
5
# First, get an instance of BSHCore contract
6
truffle(moonbeamlocal)> let bshCore = await BSHCore.deployed()
7
8
# Add additional Ownership role - Caller: Owner
9
truffle(moonbeamlocal)> await bshCore.addOwner("Address of an additional Owner")
10
11
# Remove current Ownership role - Caller: Owner
12
truffle(moonbeamlocal)> await bshCore.removeOwner("Address of Owner being removed")
13
14
# Query a list of current Owners - Caller: Any
15
truffle(moonbeamlocal)> await bshCore.getOwners()
16
17
# Update a new address of BSHPerif contract - Caller: Owner
18
truffle(moonbeamlocal)> await bshCore.updateBSHPeriphery("Address of new BSHPerif contract")
19
20
# Update a new URI - Caller: Owner
21
truffle(moonbeamlocal)> await bshCore.updateUri("New URI")
22
23
# Set a new fee ratio - Caller: Owner
24
truffle(moonbeamlocal)> await bshCore.setFeeRatio(New Fee Ratio)
25
26
# Register a new coin/wrapped coin - Caller: Owner
27
truffle(moonbeamlocal)> await bshCore.register("A coin name")
28
29
# Query current supporting coin/wrapped coins - Caller: Any
30
truffle(moonbeamlocal)> await bshCore.coinNames()
31
32
# Query a coinID of given 'coinName' - Caller: Any
33
truffle(moonbeamlocal)> await bshCore.coinId("A coin name")
34
35
# Query a balance of one account given by a 'coinName' - Caller: Any
36
# Returning balance consist of _usableBalance, _lockedBalance, and _refundableBalance
37
truffle(moonbeamlocal)> await bshCore.getBalanceOf("Account Address", "Coin name")
38
39
# Query a balance of one account given by a list of 'coinNames' - Caller: Any
40
# Returning balance consist of _usableBalances[], _lockedBalances[], and _refundableBalances[]
41
# respectively to a given list of 'coinNames'
42
truffle(moonbeamlocal)> await bshCore.getBalanceOfBatch("Account Address", An array of Coin Names)
43
44
# Query Aggregation Fees - Caller: Any
45
# Return ['Coin Name', Amount]
46
truffle(moonbeamlocal)> await bshCore.getAccumulatedFees()
47
48
# Transfer Native Coin of Moonriver to another network - Caller: Any
49
truffle(moonbeamlocal)> await bshCore.transferNativeCoin("BTP address of receiver", {from: "Account Address", value: _amount})
50
51
# Transfer Wrapped Coin from Moonriver to another network - Caller: Any
52
truffle(moonbeamlocal)> await bshCore.transfer("Coin Name", _amount, "BTP address of receiver")
53
54
# Transfer Wrapped Coins from Moonriver to another network - Caller: Any
55
truffle(moonbeamlocal)> await bshCore.transferBatch(Array of Coin Names, Array of Amount, "BTP address of receiver")
56
57
# Transfer Coin + Wrapped Coins from Moonriver to another network - Caller: Any
58
# Warning: please do not attach a native coin name into 'Array of Coin Names'. If so, it's failed likely
59
truffle(moonbeamlocal)> await bshCore.transferBatch(Array of Coin Names, Array of Amount, "BTP address of receiver", {from: "Account Address", value: _amount})
60
61
# Reclaim a refundable balance - Caller: Any
62
truffle(moonbeamlocal)> await bshCore.reclaim("Coin Name", _amount)
63
64
65
# Below command working with BSHPeriphery contract
66
# First, get an instance of BSHPeriphery contract
67
truffle(moonbeamlocal)> let bshPeriphery = await BSHPeriphery.deployed()
68
69
# Check whether BSHPeriphery contract has any pending request
70
# Return True/False
71
truffle(moonbeamlocal)> await bshPeriphery.hasPendingRequest()
Copied!

MOON-BMC

1
# Attention: These commands should be executed within truffle console and in the directory (../solidity/bmc)
2
truffle console --network moonbeamlocal
3
4
# Below commands working with BMCPeriphery contract
5
# First, get an instance of BMCPeriphery contract
6
let bmcPeriphery = await BMCPeriphery.deployed()
7
8
# Query BTP address of BMCPeriphery - Caller: Any
9
truffle(moonbeamlocal)> await bmcPeriphery.getBmcBtpAddress()
10
11
# Get status of a given link 'Link Name' - Caller: Any
12
truffle(moonbeamlocal)> await bmcPeriphery.getStatus("Link Name")
13
14
# Below commands working with BMCManagement contract
15
# First, get an instance of BMCManagement contract
16
let bmcManagement = await BMCManagement.deployed()
17
18
# Set a new address of BMCPeriphery contract - Caller: Owner
19
truffle(moonbeamlocal)> await bmcManagement.setBMCPeriphery("Address of BMCPerif")
20
21
# Add additional Ownership role - Caller: Owner
22
truffle(moonbeamlocal)> await bmcManagement.addOwner("Address of an additional Owner")
23
24
# Remove current Ownership role - Caller: Owner
25
truffle(moonbeamlocal)> await bmcManagement.removeOwner("Address of Owner being removed")
26
27
# Check whether one address has an Ownership role - Caller: Owner
28
truffle(moonbeamlocal)> await bmcManagement.isOwner("Address of account being verified")
29
30
# Register BSH Service - Caller: Owner
31
truffle(moonbeamlocal)> await bmcManagement.addService("Service Name", "Address of BSH Service")
32
33
# Remove current BSH Service - Caller: Owner
34
truffle(moonbeamlocal)> await bmcManagement.removeService("Service Name")
35
36
# Get all services - Caller: Any
37
# Return ['Service Name', 'Address of BSH']
38
truffle(moonbeamlocal)> await bmcManagement.getServices()
39
40
# Register BMV - Caller: Owner
41
truffle(moonbeamlocal)> await bmcManagement.addVerifier("Netword ID", "Address of BMV")
42
43
# Remove current BMV - Caller: Owner
44
truffle(moonbeamlocal)> await bmcManagement.removeVerifier("Netword ID")
45
46
# Get all BMVs - Caller: Any
47
# Return ['Netword ID', 'Address of BMV']
48
truffle(moonbeamlocal)> await bmcManagement.getVerifiers()
49
50
# Add connecting link - Caller: Owner
51
truffle(moonbeamlocal)> await bmcManagement.addLink("BTP address of connecting BMC")
52
53
# Remove connected link - Caller: Owner
54
truffle(moonbeamlocal)> await bmcManagement.removeLink("BTP address of connected BMC")
55
56
# Get current connected links - Caller: Any
57
truffle(moonbeamlocal)> await bmcManagement.getLinks()
58
59
# Set new configuration of connected link - Caller: Any
60
truffle(moonbeamlocal)> await bmcManagement.setLink("BTP address of connected BMC", _blockInterval, _maxAggregation, _delayLimit)
61
62
# Add Route - Caller: Owner
63
truffle(moonbeamlocal)> await bmcManagement.addRoute("BTP address of destination BMC", "BTP address of BMC before destination")
64
65
# Remove Route - Caller: Owner
66
truffle(moonbeamlocal)> await bmcManagement.removeRoute("BTP address of destination BMC")
67
68
# Get Route - Caller: Any
69
truffle(moonbeamlocal)> await bmcManagement.getRoutes("BTP address of destination BMC")
70
71
# Add Relays - Caller: Owner
72
truffle(moonbeamlocal)> await bmcManagement.addRelay("BTP address of connected BMC", Array address of Relays)
73
74
# Remove Relay - Caller: Owner
75
truffle(moonbeamlocal)> await bmcManagement.removeRelay("BTP address of connected BMC", "Address of Relay being removed")
76
77
# Get Relays - Caller: Any
78
truffle(moonbeamlocal)> await bmcManagement.getRelays("BTP address of connected BMC")
Copied!

MOON-BMV

1
# Attention: These commands should be executed within truffle console and in the directory (../solidity/bmv)
2
truffle console --network moonbeamlocal
3
4
# First, get an instance of BMV contract
5
truffle(moonbeamlocal)> let bmv = await BMV.deployed()
6
7
# Get connected BMC - Caller: Any
8
truffle(moonbeamlocal)> await bmv.getConnectedBMC()
9
10
# Get Network ID - Caller: Any
11
truffle(moonbeamlocal)> await bmv.getNetAddress()
Copied!

ICON-Error Response Codes

BTP Exception Response Code has a range as:
  • BTPException.BTP => 0 ~ 9
  • BTPException.BMC => 10 ~ 24
  • BTPException.BMV => 25 ~ 39
  • BTPException.BSH => 40 ~ 54
  • BTPException.RESERVED => 55 ~ 68
BMC - BTP Exception of common errors:
  • Unknown(10)
  • Unauthorized(11)
  • InvalidSn(12)
  • AlreadyExistsBMV(13)
  • NotExistsBMV(14)
  • AlreadyExistsBSH(15)
  • NotExistsBSH(16)
  • AlreadyExistsLink(17)
  • NotExistsLink(18)
  • AlreadyExistsBMR(19)
  • NotExistsBMR(20)
  • Unreachable(21)
BSH - BTP Exception of common errors:
  • Unknown(40)
  • Unauthorized(41)
  • IRC31Failure(42)
  • IRC31Reverted(43)
Last modified 13d ago