Go Methods for Token Conversion

Blockchain App Builder automatically generates methods that you can use to convert fungible tokens that use the Token Taxonomy Framework standard.

The token conversion methods include the concept of the exchange pool. The exchange pool account is funded by other token accounts. When you mint tokens, you can specify that a percentage of the minted tokens are transferred to the exchange pool account.

Token Conversion Process

A typical flow for converting tokens follows these steps:
  1. Call the InitializeExchangePoolUser method to initialize the exchange pool user.
  2. Call the CreateExchangePoolAccounts method to create exchange pool accounts. Create an exchange pool account for every type of fungible token that you want to convert from or convert to.
  3. Call the AddConversionRate method to set the conversion rate for each pair of tokens that you want to convert between.
  4. Fund the exchange pool token accounts in one of the following ways:
    • Transfer tokens to the exchange pool token accounts using the standard transfer methods.
    • Call the MintWithFundingExchangePoolToken method when minting tokens, which can transfer a percentage of minted tokens to an exchange pool account.
  5. Call the TokenConversion method to convert between two fungible tokens. A single user can convert tokens between two of their token accounts, or a pair of users can directly convert tokens from one account to another.
  6. The exchange pool user can view the exchange pool account balances and account transactions.
    • Call the GetAccount method to view the balances of each of the exchange pool token accounts.
    • Call the GetAccountTransactionHistory and GetAccountTransactionHistoryWithFilters methods to view account transactions for each of the exchange pool token accounts.

Automatically Generated Token Conversion Methods

Blockchain App Builder automatically generates methods to convert between different types of fungible tokens. Controller methods must be public to be invokable. Public method names begin with an upper case character. Method names that begin with a lower case character are private.

InitializeExchangePoolUser
This method initializes the exchange pool user, which is a one-time activity. This method can be called only by a Token Admin of the chaincode.
func (t *Controller) InitializeExchangePoolUser(org_id string, user_id string) (interface{}, error) {
    auth, err := t.Ctx.Auth.CheckAuthorization("TokenConversion.InitializeExchangePoolUser", "TOKEN")
    if err != nil && !auth {
        return nil, fmt.Errorf("error in authorizing the caller  %s", err.Error())
    }
    return t.Ctx.TokenConvertor.InitializeExchangePoolUser(org_id, user_id)
}
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the exchange pool user.
Return Value Example:
{
    "AssetType": "oconversion",
    "ConvertorId": "bcb1f3b1442c625d3ce205660c5e717c5858a1fe1e12c325df799a851ceaa09b",
    "OrgId": "Org1MSP",
    "UserId": "exchangepooluser"
}
CreateExchangePoolAccounts
This method creates exchange pool token accounts for a given array of token IDs. This method can be called only by a Token Admin of the chaincode.
func (t *Controller) CreateExchangePoolAccounts(token_ids []string) (interface{}, error) {
    auth, err := t.Ctx.Auth.CheckAuthorization("TokenConversion.InitializeExchangePoolUser", "TOKEN")
    if err != nil && !auth {
        return nil, fmt.Errorf("error in authorizing the caller  %s", err.Error())
    }
    var tokens []interface{}
    for _, tokenId := range token_ids {
        token, err := t.getTokenObject(tokenId)
        if err != nil {
            return nil, fmt.Errorf("error in getting from_token asset details. Error: %s", err)
        }
        tokens = append(tokens, token.Interface())
    }
    return t.Ctx.TokenConvertor.CreateExchangePoolAccounts(tokens)
}
Parameters:
  • token_ids: string [] – An array of token IDs. You can specify up to ten token IDs.
Returns:
  • On success, a list of objects that includes details of the exchange pool accounts that were created.
Return Value Example:
[
    {
        "AccountId": "oaccount~cc9d84f6d4a5976532493ef5200c9603e138adc35166ffd5fd1aad9c1647f034",
        "Status": "created",
        "TokenId": "USD"
    },
    {
        "AccountId": "oaccount~3d4933111ec8bd6cc1ebb43f2b2c390deb929cfa534f9c6ada8e63bac04a13c0",
        "Status": "created",
        "TokenId": "INR"
    }
]
AddConversionRate
This method adds a conversion rate for a pair of tokens. The token conversion rate can be specified up to eight decimal places. This method can be called only by a Token Admin of the chaincode.
func (t *Controller) AddConversionRate(from_token_id string, to_token_id string, token_conversion_rate float64) (interface{}, error) {
    auth, err := t.Ctx.Auth.CheckAuthorization("TokenConversion.AddConversionRate", "TOKEN")
    if err != nil && !auth {
        return nil, fmt.Errorf("error in authorizing the caller  %s", err.Error())
    }
    return t.Ctx.TokenConvertor.AddConversionToken(from_token_id, to_token_id, token_conversion_rate)
}
Parameters:
  • from_token_id: string – The ID of the token to convert from.
  • to_token_id: string – The ID of the token to convert to.
  • token_conversion_rate: float64 – The rate at which to convert from_token_id token to the to_token_id token.
Returns:
  • On success, a JSON representation of the conversion rate object.
Return Value Example:
{
    "AssetType": "oconversionRate",
    "ConvertorRateId": "oconversionRate~79eacc670928bbc4c9ba4ebee135c8b4d6411af3110f8a9b782c383d5e18b150",
    "FromTokenId": "USD",
    "ToTokenId": "INR",
    "ConversionRate": 10
}
GetConversionRate
This method gets the current conversion rate for a pair of tokens. This method can be called by the Token Admin of the chaincode, any Org Admin, and by any token account owner.
func (t *Controller) GetConversionRate(from_token_id string, to_token_id string) (interface{}, error) {
    auth, err := t.Ctx.Auth.CheckAuthorization("TokenConversion.GetConversionRate", "TOKEN")
    if err != nil && !auth {
        return nil, fmt.Errorf("error in authorizing the caller  %s", err.Error())
    }
    conversionRateId, err := t.Ctx.TokenConversionRate.GetConversionRateId(from_token_id, to_token_id)
    if err != nil {
        return nil, fmt.Errorf("error in getting conversationRateId. Error: %s", err)
    }
    return t.Ctx.TokenConversionRate.Get(conversionRateId)
}
Parameters:
  • from_token_id: string – The ID of the token to convert from.
  • to_token_id: string – The ID of the token to convert to.
Returns:
  • On success, a JSON representation of the conversion rate object.
Return Value Example:
{
    "AssetType": "oconversionRate",
    "ConvertorRateId": "oconversionRate~79eacc670928bbc4c9ba4ebee135c8b4d6411af3110f8a9b782c383d5e18b150",
    "FromTokenId": "USD",
    "ToTokenId": "INR",
    "ConversionRate": 10
}
UpdateConversionRate
This method updates the current conversion rate for a pair of tokens. The token conversion rate can be specified up to eight decimal places. This method can be called only by a Token Admin of the chaincode.
func (t *Controller) UpdateConversionRate(from_token_id string, to_token_id string, token_conversion_rate float64) (interface{}, error) {
    auth, err := t.Ctx.Auth.CheckAuthorization("TokenConversion.UpdateConversionRate", "TOKEN")
    if err != nil && !auth {
        return nil, fmt.Errorf("error in authorizing the caller  %s", err.Error())
    }
    return t.Ctx.TokenConvertor.UpdateTokenConversionRate(from_token_id, to_token_id, token_conversion_rate)
}
Parameters:
  • from_token_id: string – The ID of the token to convert from.
  • to_token_id: string – The ID of the token to convert to.
  • token_conversion_rate: float64 – The rate at which to convert from_token_id token to the to_token_id token.
Returns:
  • On success, a JSON representation of the updated conversion rate object.
Return Value Example:
{
    "AssetType": "oconversionRate",
    "ConvertorRateId": "oconversionRate~79eacc670928bbc4c9ba4ebee135c8b4d6411af3110f8a9b782c383d5e18b150",
    "FromTokenId": "USD",
    "ToTokenId": "INR",
    "ConversionRate": 15
}
MintWithFundingExchangePool
This method mints tokens in the caller's account based on the specified token ID and quantity. A percentage of tokens from the minted quantity is then transferred to the exchange pool token account.
func (t *Controller) MintWithFundingExchangePool(token_id string, token_quantity float64, percentage_token_to_exchangePool float64) (interface{}, error) {
    token, err := t.getTokenObject(token_id)
    if err != nil {
        return nil, fmt.Errorf("error in getting from_token asset details. Error: %s", err)
    }
    return t.Ctx.TokenConvertor.MintWithFundingExchangePool(token.Interface(), token_quantity, percentage_token_to_exchangePool)
}
Parameters:
  • token_id: string – The ID of the token to mint.
  • token_quantity: float64 – The total number of tokens to mint.
  • percentage_token_to_exchange_pool: float64 – The percentage of minted tokens to transfer to the exchange pool token account.
Returns:
  • On success, a message that indicates that minting and funding the exchange pool were successful.
Return Value Example:
{
    "msg": "successfully minted 100 tokens to AccountId: 'oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1' (OrgId: Org1MSP, User-Id: admin) and Successfully transfered 80 tokens to exchange pool account with AccountId: 'oaccount~3d4933111ec8bd6cc1ebb43f2b2c390deb929cfa534f9c6ada8e63bac04a13c0' (OrgId: Org1MSP, UserId: exchangepooluser) "
}
TokenConversion
This method converts tokens from the caller's account to the account specified by the to_token_id, to_org_id, and to_user_id values. This method can be called by the Token Admin of the chaincode and by any token account owner. An exchange pool user cannot call this method.
func (t *Controller) TokenConversion(from_token_id string, to_token_id string, to_org_id string, to_user_id string, token_quantity float64) (interface{}, error) {
    auth, err := t.Ctx.Auth.CheckAuthorization("TokenConversion.TokenConversion", "TOKEN")
    if err != nil && !auth {
        return nil, fmt.Errorf("error in authorizing the caller  %s", err.Error())
    }
    from_token, err := t.getTokenObject(from_token_id)
    if err != nil {
        return nil, fmt.Errorf("error in getting from_token asset details. Error: %s", err)
    }
    to_token, err := t.getTokenObject(to_token_id)
    if err != nil {
        return nil, fmt.Errorf("error in getting to_token asset details. error: %s", err)
    }
    return t.Ctx.TokenConvertor.TokenConversion(from_token.Interface(), to_token.Interface(), to_org_id, to_user_id, token_quantity)
}
Parameters:
  • from_token_id: string – The ID of the token to convert from.
  • to_token_id: string – The ID of the token to convert to.
  • to_org_id: string – The membership service provider (MSP) ID of the user in the current organization to receive the tokens.
  • to_user_id: string – The user name or email ID of the user to receive the tokens.
  • token_quantity: float64 – The total number of tokens to transfer.
Returns:
  • On success, a message that indicates the token conversion was successful.
Return Value Example:
{
    "msg": "succesfully converted 5 of tokens with tokenId: [USD] from AccountId: 'oaccount~abc74791148b761352b98df58035601b6f5480448ac2b4a3a7eb54bdbebf48eb' (OrgId: Org1MSP, UserId: admin) to 75 of tokens with tokenId: [INR] to AccountId: 'oaccount~25e2e66718b6dbb59aea9c32acebec60e09d912b2578d4933d377ae5d0628f1e' ( OrgId: Org1MSP, UserId: user ) as per the conversion rate of 15"
}
GetConversionHistory
This method returns the token conversion history for a specified token account. This method can be called by the Token Admin of the chaincode, an Org Admin of the specified organization, and by the token account owner.
func (t *Controller) GetConversionHistory(token_id string, org_id string, user_id string) (interface{}, error) {
    auth, err := t.Ctx.Auth.CheckAuthorization("TokenConversion.GetConversionHistory", "TOKEN")
    if err != nil && !auth {
        return nil, fmt.Errorf("error in authorizing the caller  %s", err.Error())
    }
    account_id, err := t.Ctx.Account.GenerateAccountId(token_id, org_id, user_id)
    if err != nil {
        return nil, fmt.Errorf("error in generating the accoint_id. Error: %s", err)
    }
    return t.Ctx.Account.GetTokenConversionHistory(account_id, org_id, user_id)
}
Parameters:
  • token_id: string – The ID of the token.
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a JSON object with conversion history details.
Return Value Example:
[
    {
        "balance": 95,
        "conversion_rate": 15,
        "converted_amount": 75,
        "from_account_id": "oaccount~abc74791148b761352b98df58035601b6f5480448ac2b4a3a7eb54bdbebf48eb",
        "from_token_id": "USD",
        "onhold_balance": 0,
        "timestamp": "2022-12-01T00:54:33+05:30",
        "to_account_id": "oaccount~25e2e66718b6dbb59aea9c32acebec60e09d912b2578d4933d377ae5d0628f1e",
        "to_token_id": "INR",
        "transacted_amount": 5,
        "transaction_id": "otransaction~e1f5c32ab3cdc17a51ff0edda6bcc71b5acec3320a69f68a4ae455ed416657fa",
        "transaction_type": "TOKEN_CONVERSION_DEBIT"
    }
]
GetConversionRateHistory
This method returns the token conversion rate history for a pair of tokens. This method can be called by the Token Admin of the chaincode, any Org Admin, and by any token account owner.
func (t *Controller) GetConversionRateHistory(from_token_id string, to_token_id string) (interface{}, error) {
    auth, err := t.Ctx.Auth.CheckAuthorization("TokenConversion.GetConversionRateHistory", "TOKEN")
    if err != nil && !auth {
        return nil, fmt.Errorf("error in authorizing the caller  %s", err.Error())
    }
    conversion_rate_id, err := t.Ctx.TokenConversionRate.GetConversionRateId(from_token_id, to_token_id)
    if err != nil {
        return nil, fmt.Errorf("error in getting conversionRateId. Error: %s", err)
    }
    return t.Ctx.TokenConversionRate.History(conversion_rate_id)
}
Parameters:
  • from_token_id: string – The ID of the token to convert from, for the purpose of calculating the conversion rate.
  • to_token_id: string – The ID of the token to convert to, for the purpose of calculating the conversion rate.
Returns:
  • On success, a JSON object with conversion rate history details.
Return Value Example:
[
  {
    "IsDelete": "false",
    "Timestamp": "2022-12-01T00:48:58+05:30",
    "TxId": "d6c5332278d33beddbc48e535029af424fef2129bf49f4906f9b527e101d95f1",
    "Value": {
      "AssetType": "oconversionRate",
      "ConversionRate": 15,
      "ConvertorRateId": "oconversionRate~79eacc670928bbc4c9ba4ebee135c8b4d6411af3110f8a9b782c383d5e18b150",
      "FromTokenId": "USD",
      "ToTokenId": "INR"
    }
  },
  {
    "IsDelete": "false",
    "Timestamp": "2022-12-01T00:47:15+05:30",
    "TxId": "e8796578351e948827d5dfe242ab4be59019ae67d69d3bfd6db255a268d57017",
    "Value": {
      "AssetType": "oconversionRate",
      "ConversionRate": 10,
      "ConvertorRateId": "oconversionRate~79eacc670928bbc4c9ba4ebee135c8b4d6411af3110f8a9b782c383d5e18b150",
      "FromTokenId": "USD",
      "ToTokenId": "INR"
    }
  }
]
GetExchangePoolUser
This method returns the org_id and user_id values for the exchange pool user. This method can be called only by a Token Admin of the chaincode.
func (t *Controller) GetExchangePoolUser() (interface{}, error) {
    auth, err := t.Ctx.Auth.CheckAuthorization("TokenConversion.GetExchangePoolUser", "TOKEN")
    if err != nil && !auth {
        return nil, fmt.Errorf("error in authorizing the caller  %s", err.Error())
    }
    return t.Ctx.TokenConvertor.GetExchangePoolUser()
}
Parameters:
  • none
Returns:
  • On success, a message with information about the exchange pool user.
Return Value Example:
{
    "AssetType": "oconversion",
    "ConvertorId": "bcb1f3b1442c625d3ce205660c5e717c5858a1fe1e12c325df799a851ceaa09b",
    "OrgId": "Org1MSP",
    "UserId": "exchangepooluser"
}

Token Conversion SDK Methods

InitializeExchangePoolUser
This method initializes the exchange pool user, which is a one-time activity. This method can be called only by a Token Admin of the chaincode.
Ctx.TokenConvertor.InitializeExchangePoolUser(org_id string, user_id string) (interface{}, error)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the exchange pool user.
Return Value Example:
{
    "AssetType": "oconversion",
    "ConvertorId": "bcb1f3b1442c625d3ce205660c5e717c5858a1fe1e12c325df799a851ceaa09b",
    "OrgId": "Org1MSP",
    "UserId": "exchangepooluser"
}
CreateExchangePoolAccounts
This method creates exchange pool token accounts for a given array of token IDs. This method can be called only by a Token Admin of the chaincode.
Ctx.TokenConvertor.CreateExchangePoolAccounts(tokens []interface{}) (interface{}, error)
Parameters:
  • token_ids: string [] – An array of token IDs.
Returns:
  • On success, a list of objects that includes details of the exchange pool accounts that were created.
Return Value Example:
[
    {
        "AccountId": "oaccount~cc9d84f6d4a5976532493ef5200c9603e138adc35166ffd5fd1aad9c1647f034",
        "Status": "created",
        "TokenId": "USD"
    },
    {
        "AccountId": "oaccount~3d4933111ec8bd6cc1ebb43f2b2c390deb929cfa534f9c6ada8e63bac04a13c0",
        "Status": "created",
        "TokenId": "INR"
    }
]
AddConversionToken
This method adds tokens with a new conversion rate for a specified token. The token conversion rate can be specified up to eight decimal places. This method can be called only by a Token Admin of the chaincode.
Ctx.TokenConvertor.AddConversionToken(from_token_id string, to_token_id string, token_conversion_rate float64) (interface{}, error)
Parameters:
  • from_token_id: string – The ID of the token to convert from.
  • to_token_id: string – The ID of the token to convert to.
  • token_conversion_rate: float64 – The rate at which to convert from_token_id token to the to_token_id token.
Returns:
  • On success, a JSON representation of the conversion rate object.
Return Value Example:
{
    "AssetType": "oconversionRate",
    "ConvertorRateId": "oconversionRate~79eacc670928bbc4c9ba4ebee135c8b4d6411af3110f8a9b782c383d5e18b150",
    "FromTokenId": "USD",
    "ToTokenId": "INR",
    "ConversionRate": 10
}
Get
This method gets the current conversion rate for a pair of tokens. This method can be called by the Token Admin of the chaincode and by any token account owner.
Ctx.TokenConversionRate.Get(id string) (ConversionRate, error)
Parameters:
  • id: string – The ID of the token conversion rate object.
Returns:
  • On success, a JSON representation of the conversion rate object.
Return Value Example:
{
    "AssetType": "oconversionRate",
    "ConvertorRateId": "oconversionRate~79eacc670928bbc4c9ba4ebee135c8b4d6411af3110f8a9b782c383d5e18b150",
    "FromTokenId": "USD",
    "ToTokenId": "INR",
    "ConversionRate": 10
}
UpdateTokenConversionRate
This method updates the current conversion rate for a pair of tokens. The token conversion rate can be specified up to eight decimal places. This method can be called only by a Token Admin of the chaincode.
Ctx.TokenConvertor.UpdateTokenConversionRate(from_token_id string, to_token_id string, token_conversion_rate float64) (interface{}, error)
Parameters:
  • from_token_id: string – The ID of the token to convert from.
  • to_token_id: string – The ID of the token to convert to.
  • token_conversion_rate: float64 – The rate at which to convert from_token_id token to the to_token_id token.
Returns:
  • On success, a JSON representation of the updated conversion rate object.
Return Value Example:
{
    "AssetType": "oconversionRate",
    "ConvertorRateId": "oconversionRate~79eacc670928bbc4c9ba4ebee135c8b4d6411af3110f8a9b782c383d5e18b150",
    "FromTokenId": "USD",
    "ToTokenId": "INR",
    "ConversionRate": 15
}
MintWithFundingExchangePool
This method mints tokens in the caller's account based on the specified token ID and quantity. A percentage of tokens from the minted quantity is then transferred to the exchange pool token account.
Ctx.TokenConvertor.MintWithFundingExchangePool(token interface{}, token_quantity float64, percentage_token_to_exchangePool float64) (interface{}, error)
Parameters:
  • token_id: string – The ID of the token to mint.
  • token_quantity: float64 – The total number of tokens to mint.
  • percentage_token_to_exchange_pool: float64 – The percentage of minted tokens to transfer to the exchange pool token account.
Returns:
  • On success, a message that indicates that minting and funding the exchange pool were successful.
Return Value Example:
{
    "msg": "successfully minted 100 tokens to AccountId: 'oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1' (OrgId: Org1MSP, User-Id: admin) and Successfully transfered 80 tokens to exchange pool account with AccountId: 'oaccount~3d4933111ec8bd6cc1ebb43f2b2c390deb929cfa534f9c6ada8e63bac04a13c0' (OrgId: Org1MSP, UserId: exchangepooluser) "
}
TokenConversion
This method converts tokens from the caller's account to the account specified by the to_token_id, to_org_id, and to_user_id values. This method can be called by the Token Admin of the chaincode and by any token account owner. An exchange pool user cannot call this method.
Ctx.TokenConvertor.TokenConversion(from_token interface{}, to_token interface{}, to_org_id string, to_user_id string, token_quantity float64) (interface{}, error)
Parameters:
  • from_token_id: string – The ID of the token to convert from.
  • to_token_id: string – The ID of the token to convert to.
  • to_org_id: string – The membership service provider (MSP) ID of the user in the current organization to receive the tokens.
  • to_user_id: string – The user name or email ID of the user to receive the tokens.
Returns:
  • On success, a message that indicates the token conversion was successful.
Return Value Example:
{
    "msg": "succesfully converted 5 of tokens with tokenId: [USD] from AccountId: 'oaccount~abc74791148b761352b98df58035601b6f5480448ac2b4a3a7eb54bdbebf48eb' (OrgId: Org1MSP, UserId: admin) to 75 of tokens with tokenId: [INR] to AccountId: 'oaccount~25e2e66718b6dbb59aea9c32acebec60e09d912b2578d4933d377ae5d0628f1e' ( OrgId: Org1MSP, UserId: user ) as per the conversion rate of 15"
}
GetTokenConversionHistory
This method returns the token conversion history for a specified token account. This method can be called by the Token Admin of the chaincode and by the token account owner.
Ctx.Account.GetTokenConversionHistory(account_id string, org_id string, user_id string) (interface{}, error)
Parameters:
  • account_id: string – The ID of the fungible token account.
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a JSON object with conversion history details.
Return Value Example:
[
    {
        "balance": 95,
        "conversion_rate": 15,
        "converted_amount": 75,
        "from_account_id": "oaccount~abc74791148b761352b98df58035601b6f5480448ac2b4a3a7eb54bdbebf48eb",
        "from_token_id": "USD",
        "onhold_balance": 0,
        "timestamp": "2022-12-01T00:54:33+05:30",
        "to_account_id": "oaccount~25e2e66718b6dbb59aea9c32acebec60e09d912b2578d4933d377ae5d0628f1e",
        "to_token_id": "INR",
        "transacted_amount": 5,
        "transaction_id": "otransaction~e1f5c32ab3cdc17a51ff0edda6bcc71b5acec3320a69f68a4ae455ed416657fa",
        "transaction_type": "TOKEN_CONVERSION_DEBIT"
    }
]
history
This method returns the token conversion rate history for a pair of tokens. This method can be called by the Token Admin of the chaincode, any Org Admin, and by any token account owner.
Ctx.TokenConversionRate.History(conversion_rate_id string) (interface{}, error)
Parameters:
  • conversion_rate_id: string – The ID of the conversion rate object.
Returns:
  • On success, a JSON object with conversion rate history details.
Return Value Example:
[
  {
    "IsDelete": "false",
    "Timestamp": "2022-12-01T00:48:58+05:30",
    "TxId": "d6c5332278d33beddbc48e535029af424fef2129bf49f4906f9b527e101d95f1",
    "Value": {
      "AssetType": "oconversionRate",
      "ConversionRate": 15,
      "ConvertorRateId": "oconversionRate~79eacc670928bbc4c9ba4ebee135c8b4d6411af3110f8a9b782c383d5e18b150",
      "FromTokenId": "USD",
      "ToTokenId": "INR"
    }
  },
  {
    "IsDelete": "false",
    "Timestamp": "2022-12-01T00:47:15+05:30",
    "TxId": "e8796578351e948827d5dfe242ab4be59019ae67d69d3bfd6db255a268d57017",
    "Value": {
      "AssetType": "oconversionRate",
      "ConversionRate": 10,
      "ConvertorRateId": "oconversionRate~79eacc670928bbc4c9ba4ebee135c8b4d6411af3110f8a9b782c383d5e18b150",
      "FromTokenId": "USD",
      "ToTokenId": "INR"
    }
  }
]
GetExchangePoolUser
This method returns the org_id and user_id values for the exchange pool user. This method can be called only by a Token Admin of the chaincode.
Ctx.TokenConvertor.GetExchangePoolUser()
Parameters:
  • none
Returns:
  • On success, a message with information about the exchange pool user.
Return Value Example:
{
    "AssetType": "oconversion",
    "ConvertorId": "bcb1f3b1442c625d3ce205660c5e717c5858a1fe1e12c325df799a851ceaa09b",
    "OrgId": "Org1MSP",
    "UserId": "exchangepooluser"
}