Create new carbon_credit_balance_on_chain
POST /obp/dynamic-entity/banks/ogcr/carbon_credit_balance_on_chain
OBPv4.0.0-dynamicEntity_createcarbon_credit_balance_on_chain_ogcr Roles: CanCreateDynamicEntityRecord_carbon_credit_balance_on_chain(per bank) _Carbon_credit_balance_on_chain(ogcr)Dynamic-EntityDynamic
Create new carbon_credit_balance_on_chain.
Cache of CarbonCredit (ERC-20) balances on the OGCR chain (chain id 20253). One record per holding address, covering both operator wallets and the ERC-6551 token-bound accounts of credit batches. Populated by OGCR-chain-cache, which derives the holder set from Transfer events and then reads each balance at the current head. Balances are current-state, not historical: each record is only true as of block_number.
Property List:
- balance: CarbonCredit balance in smallest units, as read at block_number. Decimal string because a uint256 does not fit an integer field. Divide by 10^decimals for tonnes CO2e.
- batch_token_id: When holder_type is token_bound_account, the CarbonCreditBatchNFT token id this account belongs to. 0 otherwise. Join to
carbon_credit_batch_on_chain.token_id. - block_number: Block height the balance was read at.
- chain_id: EVM chain id (OGCR chain = 20253).
- contract_address: CarbonCredit ERC-20 contract address the balance was read from.
- decimals: Decimals of the CarbonCredit ERC-20, for rendering balance.
- holder_type: Whether this address is a plain wallet or the ERC-6551 token-bound account of a credit batch. One of: wallet, token_bound_account. A token_bound_account balance is credits still held inside their batch; a wallet balance is credits withdrawn from a batch and now pooled.
- owner_address: Address holding the balance, lowercase-insensitive checksum form. The business key for this record. Match against operator.ogcr_wallet_address or land_manager.ogcr_wallet_address to find a party's holdings.
- symbol: Symbol of the CarbonCredit ERC-20.
MethodRouting settings example:
<details>
{
"is_bank_id_exact_match":false,
"method_name":"dynamicEntityProcess",
"connector_name":"rest_vMar2019",
"bank_id_pattern":".*",
"parameters":[
{
"key":"entityName",
"value":"carbon_credit_balance_on_chain"
}
{
"key":"url",
"value":"http://mydomain.com/xxx"
}
]
}
</details>
User Authentication is Required. The User must be logged in. The Application must also be authenticated.
Example request body
{
"balance": "1000000000000000000",
"batch_token_id": 1,
"block_number": 12400,
"chain_id": 20253,
"contract_address": "0x1B4bC0dE8b6A1A2b3C4d5E6f7A8b9C0d1E2f3A4b",
"decimals": 18,
"holder_type": "token_bound_account",
"owner_address": "0x30753E4A8aad7F8597332E813735Def5dD395028",
"symbol": "CC"
}Example success response
{
"bank_id": "ogcr",
"carbon_credit_balance_on_chain": {
"carbon_credit_balance_on_chain_id": "d8839721-ad8f-45dd-9f78-2080414b93f9",
"balance": "1000000000000000000",
"batch_token_id": 1,
"block_number": 12400,
"chain_id": 20253,
"contract_address": "0x1B4bC0dE8b6A1A2b3C4d5E6f7A8b9C0d1E2f3A4b",
"decimals": 18,
"holder_type": "token_bound_account",
"owner_address": "0x30753E4A8aad7F8597332E813735Def5dD395028",
"symbol": "CC"
}
}Possible errors (4)
- OBP-20001: User not logged in. Authentication is required!
- OBP-20006: User is missing one or more roles:
- OBP-10001: Incorrect json format.
- OBP-50000: Unknown Error.