{
    "types": [
        {
            "minmax": [
                0,
                100
            ],
            "types": {
                "H256Le": "H256",
                "DOT": "u128",
                "PolkaBTC": "Balance",
                "Collateral": "Balance",
                "Wrapped": "Balance",
                "StatusCode": {
                    "_enum": [
                        "Running",
                        "Error",
                        "Shutdown"
                    ]
                },
                "Address": "AccountId",
                "LookupSource": "AccountId",
                "Status": "StatusCode",
                "ErrorCode": {
                    "_enum": [
                        "None",
                        "NoDataBTCRelay",
                        "InvalidBTCRelay",
                        "OracleOffline"
                    ]
                },
                "VaultStatus": {
                    "_enum": {
                        "Active": "bool",
                        "Liquidated": "()",
                        "CommittedTheft": "()"
                    }
                },
                "RawBlockHeader": {
                    "0": "[u8; 80]"
                },
                "RichBlockHeader": {
                    "block_hash": "H256Le",
                    "block_header": "BlockHeader",
                    "block_height": "u32",
                    "chain_ref": "u32",
                    "account_id": "AccountId",
                    "para_height": "BlockNumber"
                },
                "BlockHeader": {
                    "merkle_root": "H256Le",
                    "target": "U256",
                    "timestamp": "u32",
                    "version": "i32",
                    "hash_prev_block": "H256Le",
                    "nonce": "u32"
                },
                "BlockChain": {
                    "chain_id": "u32",
                    "start_height": "u32",
                    "max_height": "u32",
                    "no_data": "BTreeSet<u32>",
                    "invalid": "BTreeSet<u32>"
                },
                "BtcAddress": {
                    "_enum": {
                        "P2PKH": "H160",
                        "P2SH": "H160",
                        "P2WPKHv0": "H160",
                        "P2WSHv0": "H256"
                    }
                },
                "BtcPublicKey": "[u8; 33]",
                "Wallet": {
                    "addresses": "BTreeSet<BtcAddress>",
                    "public_key": "BtcPublicKey"
                },
                "Vault": {
                    "id": "AccountId",
                    "to_be_issued_tokens": "Wrapped",
                    "issued_tokens": "Wrapped",
                    "to_be_redeemed_tokens": "Wrapped",
                    "wallet": "Wallet",
                    "to_be_replaced_tokens": "Wrapped",
                    "replace_collateral": "Collateral",
                    "liquidated_collateral": "Collateral",
                    "banned_until": "Option<BlockNumber>",
                    "status": "VaultStatus",
                    "slash_per_token": "SignedFixedPoint",
                    "slash_tally": "SignedFixedPoint",
                    "backing_collateral": "Collateral",
                    "total_collateral": "Collateral",
                    "collateral": "Collateral"
                },
                "IssueRequestStatus": {
                    "_enum": {
                        "Pending": "()",
                        "Completed": "Option<H256>",
                        "Cancelled": "()"
                    }
                },
                "IssueRequest": {
                    "vault": "AccountId",
                    "opentime": "BlockNumber",
                    "period": "BlockNumber",
                    "griefing_collateral": "Collateral",
                    "amount": "Wrapped",
                    "fee": "Wrapped",
                    "requester": "AccountId",
                    "btc_address": "BtcAddress",
                    "btc_public_key": "BtcPublicKey",
                    "btc_height": "u32",
                    "status": "IssueRequestStatus"
                },
                "RedeemRequestStatus": {
                    "_enum": {
                        "Pending": "()",
                        "Completed": "()",
                        "Reimbursed": "bool",
                        "Retried": "()"
                    }
                },
                "RedeemRequest": {
                    "vault": "AccountId",
                    "opentime": "BlockNumber",
                    "period": "BlockNumber",
                    "fee": "Wrapped",
                    "transfer_fee_btc": "Wrapped",
                    "amount_btc": "Wrapped",
                    "premium": "Collateral",
                    "redeemer": "AccountId",
                    "btc_address": "BtcAddress",
                    "btc_height": "u32",
                    "status": "RedeemRequestStatus"
                },
                "ReplaceRequestStatus": {
                    "_enum": [
                        "Pending",
                        "Completed",
                        "Cancelled"
                    ]
                },
                "ReplaceRequest": {
                    "old_vault": "AccountId",
                    "new_vault": "AccountId",
                    "amount": "Wrapped",
                    "griefing_collateral": "Collateral",
                    "collateral": "Collateral",
                    "accept_time": "BlockNumber",
                    "period": "BlockNumber",
                    "btc_address": "BtcAddress",
                    "btc_height": "u32",
                    "status": "ReplaceRequestStatus"
                },
                "RefundRequest": {
                    "vault": "AccountId",
                    "amount_issuing": "Wrapped",
                    "fee": "Wrapped",
                    "amount_btc": "Wrapped",
                    "issuer": "AccountId",
                    "btc_address": "BtcAddress",
                    "issue_id": "H256",
                    "completed": "bool"
                },
                "BalanceWrapper": {
                    "amount": "String"
                },
                "BtcTxFeesPerByte": {
                    "fast": "u32",
                    "half": "u32",
                    "hour": "u32"
                },
                "Version": "u32",
                "SystemVault": {
                    "to_be_issued_tokens": "Wrapped",
                    "issued_tokens": "Wrapped",
                    "to_be_redeemed_tokens": "Wrapped"
                },
                "FixedPoint": "FixedI128",
                "SignedFixedPoint": "FixedI128",
                "UnsignedFixedPoint": "FixedU128",
                "Nominator": {
                    "id": "AccountId",
                    "vault_id": "AccountId",
                    "collateral": "Collateral",
                    "slash_tally": "Collateral"
                },
                "RelayerEvent": {
                    "_enum": [
                        "StoreBlock",
                        "TheftReport"
                    ]
                },
                "FundAccountJsonRpcRequest": {
                    "account_id": "AccountId"
                }
            }
        }
    ],
    "rpc": {
        "vaultRegistry": {
            "getFirstVaultWithSufficientCollateral": {
                "description": "Get the first available vault with sufficient collateral to fulfil an issue request with the specified amount of PolkaBTC.",
                "params": [
                    {
                        "name": "amount",
                        "type": "BalanceWrapper"
                    }
                ],
                "type": "AccountId"
            },
            "getFirstVaultWithSufficientTokens": {
                "description": "Get the first available vault with sufficient tokens to fulfil an redeem request with the specified amount of PolkaBTC.",
                "params": [
                    {
                        "name": "amount",
                        "type": "BalanceWrapper"
                    }
                ],
                "type": "AccountId"
            },
            "getPremiumRedeemVaults": {
                "description": "Get all vaults below the premium redeem threshold.",
                "params": [],
                "type": "Vec<(AccountId, BalanceWrapper)>"
            },
            "getVaultsWithIssuableTokens": {
                "description": "Get all vaults with non-zero issuable tokens, ordered in descending order of this amount",
                "params": [],
                "type": "Vec<(AccountId, BalanceWrapper)>"
            },
            "getVaultsWithRedeemableTokens": {
                "description": "Get all vaults with non-zero redeemable tokens, ordered in descending order of this amount",
                "params": [],
                "type": "Vec<(AccountId, BalanceWrapper)>"
            },
            "getIssueableTokensFromVault": {
                "description": "Get the amount of tokens a vault can issue",
                "params": [
                    {
                        "name": "vault",
                        "type": "AccountId"
                    }
                ],
                "type": "BalanceWrapper"
            },
            "getCollateralizationFromVault": {
                "description": "Returns the collateralization of a specific vault",
                "params": [
                    {
                        "name": "vault_id",
                        "type": "AccountId"
                    },
                    {
                        "name": "only_issued",
                        "type": "bool"
                    }
                ],
                "type": "UnsignedFixedPoint"
            },
            "getCollateralizationFromVaultAndCollateral": {
                "description": "Returns the collateralization of a specific vault and collateral",
                "params": [
                    {
                        "name": "vault_id",
                        "type": "AccountId"
                    },
                    {
                        "name": "collateral",
                        "type": "BalanceWrapper"
                    },
                    {
                        "name": "only_issued",
                        "type": "bool"
                    }
                ],
                "type": "UnsignedFixedPoint"
            },
            "getTotalCollateralization": {
                "description": "Get the total collateralization of the system",
                "params": [],
                "type": "UnsignedFixedPoint"
            },
            "getRequiredCollateralForWrapped": {
                "description": "Get the amount of collateral required to issue an amount of PolkaBTC",
                "params": [
                    {
                        "name": "amount_btc",
                        "type": "BalanceWrapper"
                    }
                ],
                "type": "BalanceWrapper"
            },
            "getRequiredCollateralForVault": {
                "description": "Get the amount of collateral required for the given vault to be at the current SecureCollateralThreshold with the current exchange rate",
                "params": [
                    {
                        "name": "vault_id",
                        "type": "AccountId"
                    }
                ],
                "type": "BalanceWrapper"
            },
            "isVaultBelowAuctionThreshold": {
                "description": "Check if the identified vault is below the auction threshold",
                "params": [
                    {
                        "name": "vault_id",
                        "type": "AccountId"
                    }
                ],
                "type": "bool"
            }
        },
        "exchangeRateOracle": {
            "wrappedToCollateral": {
                "description": "Wrapped to Collateral exchange rate",
                "params": [
                    {
                        "name": "amount",
                        "type": "BalanceWrapper"
                    }
                ],
                "type": "BalanceWrapper"
            },
            "collateralToWrapped": {
                "description": "Collateral to Wrapped exchange rate",
                "params": [
                    {
                        "name": "amount",
                        "type": "BalanceWrapper"
                    }
                ],
                "type": "BalanceWrapper"
            }
        },
        "sla": {
            "calculateSlashedAmount": {
                "description": "Amount that is slashed when the the vault fails to execute.",
                "params": [
                    {
                        "name": "vault_id",
                        "type": "AccountId"
                    },
                    {
                        "name": "stake",
                        "type": "BalanceWrapper"
                    },
                    {
                        "name": "at",
                        "type": "Option<BlockHash>"
                    }
                ],
                "type": "void"
            }
        },
        "stakedRelayers": {
            "isTransactionInvalid": {
                "description": "Given a sender's AccountId and the raw transaction data, determine if it's invalid",
                "params": [
                    {
                        "name": "vault_id",
                        "type": "AccountId"
                    },
                    {
                        "name": "raw_tx",
                        "type": "Vec<u8>"
                    }
                ],
                "type": "void"
            }
        },
        "issue": {
            "getIssueRequests": {
                "description": "Get all issue requests for a particular account",
                "params": [
                    {
                        "name": "account_id",
                        "type": "AccountId"
                    }
                ],
                "type": "Vec<(H256, IssueRequest)>"
            },
            "getVaultIssueRequests": {
                "description": "Get all issue requests for a particular vault",
                "params": [
                    {
                        "name": "vault_id",
                        "type": "AccountId"
                    }
                ],
                "type": "Vec<(H256, IssueRequest)>"
            }
        },
        "redeem": {
            "getRedeemRequests": {
                "description": "Get all redeem requests for a particular account",
                "params": [
                    {
                        "name": "account_id",
                        "type": "AccountId"
                    }
                ],
                "type": "Vec<(H256, RedeemRequest)>"
            },
            "getVaultRedeemRequests": {
                "description": "Get all redeem requests for a particular vault",
                "params": [
                    {
                        "name": "vault_id",
                        "type": "AccountId"
                    }
                ],
                "type": "Vec<(H256, RedeemRequest)>"
            }
        },
        "replace": {
            "getOldVaultReplaceRequests": {
                "description": "Get all replace requests from a particular vault",
                "params": [
                    {
                        "name": "account_id",
                        "type": "AccountId"
                    }
                ],
                "type": "Vec<(H256, ReplaceRequest)>"
            },
            "getNewVaultReplaceRequests": {
                "description": "Get all replace requests to a particular vault",
                "params": [
                    {
                        "name": "account_id",
                        "type": "AccountId"
                    }
                ],
                "type": "Vec<(H256, ReplaceRequest)>"
            }
        },
        "refund": {
            "getRefundRequests": {
                "description": "Get all refund requests for a particular account",
                "params": [
                    {
                        "name": "account_id",
                        "type": "AccountId"
                    }
                ],
                "type": "Vec<(H256, RefundRequest)>"
            },
            "getRefundRequestsByIssueId": {
                "description": "Get all refund requests for a particular issue ID",
                "params": [
                    {
                        "name": "issue_id",
                        "type": "H256"
                    }
                ],
                "type": "(H256, RefundRequest)"
            },
            "getVaultRefundRequests": {
                "description": "Get all refund requests for a particular vault",
                "params": [
                    {
                        "name": "account_id",
                        "type": "AccountId"
                    }
                ],
                "type": "Vec<(H256, RefundRequest)>"
            }
        }
    },
    "instances": {
        "balances": [
            "dot",
            "polkaBtc"
        ]
    }
}