From ecb5e2cce460a561acd6fa8ebb9468dac10ad1ad Mon Sep 17 00:00:00 2001 From: viraj124 Date: Wed, 18 Dec 2024 21:15:09 +0530 Subject: [PATCH 1/2] feat: add collateral supply method --- src/tools.ts | 51 +- src/types/Market.ts | 5050 +++++++++++++++++++++++++++++++++++++++++++ src/types/common.ts | 17 + 3 files changed, 5116 insertions(+), 2 deletions(-) create mode 100644 src/types/Market.ts create mode 100644 src/types/common.ts diff --git a/src/tools.ts b/src/tools.ts index 17377fc..da4f005 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -1,9 +1,11 @@ import { tool } from '@langchain/core/tools'; -import { bn, Provider, Wallet } from 'fuels'; +import { bn, Provider, Wallet, Contract } from 'fuels'; import { MiraAmm, type PoolId } from 'mira-dex-ts'; import { z } from 'zod'; import { getAllVerifiedFuelAssets } from './utils/assets.js'; import { getTxExplorerUrl } from './utils/explorer.js'; +import { Market } from './types/Market.js'; + export const transferToWallet = async ({ to, @@ -108,4 +110,49 @@ export const swapEthForUSDCTool = tool(swapEthForUSDC, { }), }); -export const tools = [transferTool, swapEthForUSDCTool]; +export const supplyCollateral = async ({ amount, symbol }: { amount: number, symbol: string }) => { + const provider = await Provider.create( + 'https://mainnet.fuel.network/v1/graphql', + ); + const wallet = Wallet.fromPrivateKey( + process.env.FUEL_WALLET_PRIVATE_KEY as string, + provider, + ); + + const marketContractId = '0x657ab45a6eb98a4893a99fd104347179151e8b3828fd8f2a108cc09770d1ebae'; + const marketContract: Market = new Market(marketContractId, wallet); + + const allAssets = await getAllVerifiedFuelAssets(); + const asset = allAssets.find((asset) => asset.symbol === symbol); + const assetId = asset?.assetId; + + const weiAmount = bn.parseUnits(amount.toString(), asset?.decimals) + + const tx: any = await marketContract.functions + .supply_collateral() + .callParams({ + forward: { + assetId: assetId, + amount: weiAmount, + } as any, + }) + .call(); + + const { id, status } = await tx.waitForResult(); + + return { + status, + id, + }; +}; + +export const supplyCollateralTool = tool(supplyCollateral, { + name: 'supply_collateral', + description: 'Supply collateral on swaylend', + schema: z.object({ + amount: z.number().describe('The amount to lend'), + symbol: z.string().describe('The asset symbol to lend. eg. USDC, ETH') + }), +}); + +export const tools = [transferTool, swapEthForUSDCTool, supplyCollateralTool]; diff --git a/src/types/Market.ts b/src/types/Market.ts new file mode 100644 index 0000000..12b9c0d --- /dev/null +++ b/src/types/Market.ts @@ -0,0 +1,5050 @@ +/* Autogenerated file. Do not edit manually. */ + +/* eslint-disable max-classes-per-file */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/consistent-type-imports */ + +/* + Fuels version: 0.96.1 +*/ + +import { Contract, Interface } from "fuels"; +import type { + Provider, + Account, + StorageSlot, + AbstractAddress, + BigNumberish, + BN, + Bytes, + FunctionFragment, + InvokeFunction, +} from 'fuels'; + +import type { Enum, Vec } from "./common.js"; + +export enum AccessErrorInput { NotOwner = 'NotOwner' }; +export enum AccessErrorOutput { NotOwner = 'NotOwner' }; +export enum ErrorInput { AlreadyInitialized = 'AlreadyInitialized', Paused = 'Paused', Unauthorized = 'Unauthorized', InsufficientReserves = 'InsufficientReserves', NotLiquidatable = 'NotLiquidatable', NotForSale = 'NotForSale', TooMuchSlippage = 'TooMuchSlippage', SupplyCapExceeded = 'SupplyCapExceeded', NotCollateralized = 'NotCollateralized', BorrowTooSmall = 'BorrowTooSmall', NotPermitted = 'NotPermitted', InvalidPayment = 'InvalidPayment', UnknownAsset = 'UnknownAsset', DebuggingDisabled = 'DebuggingDisabled', NotYetActive = 'NotYetActive', AlreadyActive = 'AlreadyActive', OracleContractIdNotSet = 'OracleContractIdNotSet', OraclePriceValidationError = 'OraclePriceValidationError' }; +export enum ErrorOutput { AlreadyInitialized = 'AlreadyInitialized', Paused = 'Paused', Unauthorized = 'Unauthorized', InsufficientReserves = 'InsufficientReserves', NotLiquidatable = 'NotLiquidatable', NotForSale = 'NotForSale', TooMuchSlippage = 'TooMuchSlippage', SupplyCapExceeded = 'SupplyCapExceeded', NotCollateralized = 'NotCollateralized', BorrowTooSmall = 'BorrowTooSmall', NotPermitted = 'NotPermitted', InvalidPayment = 'InvalidPayment', UnknownAsset = 'UnknownAsset', DebuggingDisabled = 'DebuggingDisabled', NotYetActive = 'NotYetActive', AlreadyActive = 'AlreadyActive', OracleContractIdNotSet = 'OracleContractIdNotSet', OraclePriceValidationError = 'OraclePriceValidationError' }; +export type IdentityInput = Enum<{ Address: AddressInput, ContractId: ContractIdInput }>; +export type IdentityOutput = Enum<{ Address: AddressOutput, ContractId: ContractIdOutput }>; +export enum InitializationErrorInput { CannotReinitialized = 'CannotReinitialized' }; +export enum InitializationErrorOutput { CannotReinitialized = 'CannotReinitialized' }; +export enum ReentrancyErrorInput { NonReentrant = 'NonReentrant' }; +export enum ReentrancyErrorOutput { NonReentrant = 'NonReentrant' }; +export type StateInput = Enum<{ Uninitialized: undefined, Initialized: IdentityInput, Revoked: undefined }>; +export type StateOutput = Enum<{ Uninitialized: void, Initialized: IdentityOutput, Revoked: void }>; + +export type AbsorbCollateralEventInput = { account: IdentityInput, asset_id: AssetIdInput, amount: BigNumberish, seize_value: BigNumberish, decimals: BigNumberish }; +export type AbsorbCollateralEventOutput = { account: IdentityOutput, asset_id: AssetIdOutput, amount: BN, seize_value: BN, decimals: number }; +export type AddressInput = { bits: string }; +export type AddressOutput = AddressInput; +export type AssetIdInput = { bits: string }; +export type AssetIdOutput = AssetIdInput; +export type BuyCollateralEventInput = { caller: IdentityInput, recipient: IdentityInput, asset_id: AssetIdInput, amount: BigNumberish, price: BigNumberish }; +export type BuyCollateralEventOutput = { caller: IdentityOutput, recipient: IdentityOutput, asset_id: AssetIdOutput, amount: BN, price: BN }; +export type CollateralAssetAddedInput = { asset_id: AssetIdInput, configuration: CollateralConfigurationInput }; +export type CollateralAssetAddedOutput = { asset_id: AssetIdOutput, configuration: CollateralConfigurationOutput }; +export type CollateralAssetPausedInput = { asset_id: AssetIdInput }; +export type CollateralAssetPausedOutput = { asset_id: AssetIdOutput }; +export type CollateralAssetResumedInput = { asset_id: AssetIdInput }; +export type CollateralAssetResumedOutput = { asset_id: AssetIdOutput }; +export type CollateralAssetUpdatedInput = { asset_id: AssetIdInput, configuration: CollateralConfigurationInput }; +export type CollateralAssetUpdatedOutput = { asset_id: AssetIdOutput, configuration: CollateralConfigurationOutput }; +export type CollateralConfigurationInput = { asset_id: AssetIdInput, price_feed_id: string, decimals: BigNumberish, borrow_collateral_factor: BigNumberish, liquidate_collateral_factor: BigNumberish, liquidation_penalty: BigNumberish, supply_cap: BigNumberish, paused: boolean }; +export type CollateralConfigurationOutput = { asset_id: AssetIdOutput, price_feed_id: string, decimals: number, borrow_collateral_factor: BN, liquidate_collateral_factor: BN, liquidation_penalty: BN, supply_cap: BN, paused: boolean }; +export type ContractIdInput = { bits: string }; +export type ContractIdOutput = ContractIdInput; +export type I256Input = { underlying: BigNumberish }; +export type I256Output = { underlying: BN }; +export type MarketBasicEventInput = { market_basic: MarketBasicsInput }; +export type MarketBasicEventOutput = { market_basic: MarketBasicsOutput }; +export type MarketBasicsInput = { base_supply_index: BigNumberish, base_borrow_index: BigNumberish, tracking_supply_index: BigNumberish, tracking_borrow_index: BigNumberish, total_supply_base: BigNumberish, total_borrow_base: BigNumberish, last_accrual_time: BigNumberish }; +export type MarketBasicsOutput = { base_supply_index: BN, base_borrow_index: BN, tracking_supply_index: BN, tracking_borrow_index: BN, total_supply_base: BN, total_borrow_base: BN, last_accrual_time: BN }; +export type MarketConfigurationInput = { base_token: AssetIdInput, base_token_decimals: BigNumberish, base_token_price_feed_id: string, supply_kink: BigNumberish, borrow_kink: BigNumberish, supply_per_second_interest_rate_slope_low: BigNumberish, supply_per_second_interest_rate_slope_high: BigNumberish, supply_per_second_interest_rate_base: BigNumberish, borrow_per_second_interest_rate_slope_low: BigNumberish, borrow_per_second_interest_rate_slope_high: BigNumberish, borrow_per_second_interest_rate_base: BigNumberish, store_front_price_factor: BigNumberish, base_tracking_index_scale: BigNumberish, base_tracking_supply_speed: BigNumberish, base_tracking_borrow_speed: BigNumberish, base_min_for_rewards: BigNumberish, base_borrow_min: BigNumberish, target_reserves: BigNumberish }; +export type MarketConfigurationOutput = { base_token: AssetIdOutput, base_token_decimals: number, base_token_price_feed_id: string, supply_kink: BN, borrow_kink: BN, supply_per_second_interest_rate_slope_low: BN, supply_per_second_interest_rate_slope_high: BN, supply_per_second_interest_rate_base: BN, borrow_per_second_interest_rate_slope_low: BN, borrow_per_second_interest_rate_slope_high: BN, borrow_per_second_interest_rate_base: BN, store_front_price_factor: BN, base_tracking_index_scale: BN, base_tracking_supply_speed: BN, base_tracking_borrow_speed: BN, base_min_for_rewards: BN, base_borrow_min: BN, target_reserves: BN }; +export type MarketConfigurationEventInput = { market_config: MarketConfigurationInput }; +export type MarketConfigurationEventOutput = { market_config: MarketConfigurationOutput }; +export type OwnershipRenouncedInput = { previous_owner: IdentityInput }; +export type OwnershipRenouncedOutput = { previous_owner: IdentityOutput }; +export type OwnershipSetInput = { new_owner: IdentityInput }; +export type OwnershipSetOutput = { new_owner: IdentityOutput }; +export type OwnershipTransferredInput = { new_owner: IdentityInput, previous_owner: IdentityInput }; +export type OwnershipTransferredOutput = { new_owner: IdentityOutput, previous_owner: IdentityOutput }; +export type PauseConfigurationInput = { supply_paused: boolean, withdraw_paused: boolean, absorb_paused: boolean, buy_paused: boolean }; +export type PauseConfigurationOutput = PauseConfigurationInput; +export type PauseConfigurationEventInput = { pause_config: PauseConfigurationInput }; +export type PauseConfigurationEventOutput = { pause_config: PauseConfigurationOutput }; +export type PriceInput = { confidence: BigNumberish, exponent: BigNumberish, price: BigNumberish, publish_time: BigNumberish }; +export type PriceOutput = { confidence: BN, exponent: number, price: BN, publish_time: BN }; +export type PriceDataUpdateInput = { update_fee: BigNumberish, publish_times: Vec, price_feed_ids: Vec, update_data: Vec }; +export type PriceDataUpdateOutput = { update_fee: BN, publish_times: Vec, price_feed_ids: Vec, update_data: Vec }; +export type ReservesWithdrawnEventInput = { caller: IdentityInput, to: IdentityInput, amount: BigNumberish }; +export type ReservesWithdrawnEventOutput = { caller: IdentityOutput, to: IdentityOutput, amount: BN }; +export type SetPythContractIdEventInput = { contract_id: ContractIdInput }; +export type SetPythContractIdEventOutput = { contract_id: ContractIdOutput }; +export type UserBasicInput = { principal: I256Input, base_tracking_index: BigNumberish, base_tracking_accrued: BigNumberish }; +export type UserBasicOutput = { principal: I256Output, base_tracking_index: BN, base_tracking_accrued: BN }; +export type UserBasicEventInput = { account: IdentityInput, user_basic: UserBasicInput }; +export type UserBasicEventOutput = { account: IdentityOutput, user_basic: UserBasicOutput }; +export type UserLiquidatedEventInput = { account: IdentityInput, liquidator: IdentityInput, base_paid_out: BigNumberish, base_paid_out_value: BigNumberish, total_base: BigNumberish, total_base_value: BigNumberish, decimals: BigNumberish }; +export type UserLiquidatedEventOutput = { account: IdentityOutput, liquidator: IdentityOutput, base_paid_out: BN, base_paid_out_value: BN, total_base: BN, total_base_value: BN, decimals: number }; +export type UserSupplyBaseEventInput = { account: IdentityInput, supply_amount: BigNumberish, repay_amount: BigNumberish }; +export type UserSupplyBaseEventOutput = { account: IdentityOutput, supply_amount: BN, repay_amount: BN }; +export type UserSupplyCollateralEventInput = { account: IdentityInput, asset_id: AssetIdInput, amount: BigNumberish }; +export type UserSupplyCollateralEventOutput = { account: IdentityOutput, asset_id: AssetIdOutput, amount: BN }; +export type UserWithdrawBaseEventInput = { account: IdentityInput, withdraw_amount: BigNumberish, borrow_amount: BigNumberish }; +export type UserWithdrawBaseEventOutput = { account: IdentityOutput, withdraw_amount: BN, borrow_amount: BN }; +export type UserWithdrawCollateralEventInput = { account: IdentityInput, asset_id: AssetIdInput, amount: BigNumberish }; +export type UserWithdrawCollateralEventOutput = { account: IdentityOutput, asset_id: AssetIdOutput, amount: BN }; + +export type MarketConfigurables = Partial<{ + DEBUG_STEP: BigNumberish; +}>; + +const abi = { + "programType": "contract", + "specVersion": "1", + "encodingVersion": "1", + "concreteTypes": [ + { + "type": "()", + "concreteTypeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "type": "(struct std::asset_id::AssetId, u64)", + "concreteTypeId": "229de6686c9c66098e7188f64d380a851d5ebacacaf90d991adf5b5952a70f7b", + "metadataTypeId": 0 + }, + { + "type": "(u256, u256)", + "concreteTypeId": "2770d9f762bf8ec295d5c253193cd2897c893401f1f438769f92d212641ec779", + "metadataTypeId": 1 + }, + { + "type": "b256", + "concreteTypeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b" + }, + { + "type": "bool", + "concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" + }, + { + "type": "enum market_abi::structs::Error", + "concreteTypeId": "4e6aabd209068d31558291cfd07cff9366801b052a1767bd0a9eb34bf55e8a0e", + "metadataTypeId": 2 + }, + { + "type": "enum standards::src5::AccessError", + "concreteTypeId": "3f702ea3351c9c1ece2b84048006c8034a24cbc2bad2e740d0412b4172951d3d", + "metadataTypeId": 3 + }, + { + "type": "enum standards::src5::State", + "concreteTypeId": "192bc7098e2fe60635a9918afb563e4e5419d386da2bdbf0d716b4bc8549802c", + "metadataTypeId": 4 + }, + { + "type": "enum std::identity::Identity", + "concreteTypeId": "ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335", + "metadataTypeId": 5 + }, + { + "type": "enum sway_libs::ownership::errors::InitializationError", + "concreteTypeId": "1dfe7feadc1d9667a4351761230f948744068a090fe91b1bc6763a90ed5d3893", + "metadataTypeId": 6 + }, + { + "type": "enum sway_libs::reentrancy::errors::ReentrancyError", + "concreteTypeId": "4d216c57b3357523323f59401c7355785b41bdf832f6e1106272186b94797038", + "metadataTypeId": 7 + }, + { + "type": "struct events::AbsorbCollateralEvent", + "concreteTypeId": "31d6845ccbeb9e71f30bf07140659072ce92db76041efd6861d6895dace9e658", + "metadataTypeId": 10 + }, + { + "type": "struct events::BuyCollateralEvent", + "concreteTypeId": "a95331d2168897d0f550d1c4f7fc582926a79b3e825866ecf8c11ef8dfb692c6", + "metadataTypeId": 11 + }, + { + "type": "struct events::CollateralAssetAdded", + "concreteTypeId": "ea2a9368cd82d633fcc3411dbff6c25a78c7ccf550034427221102b74d7926db", + "metadataTypeId": 12 + }, + { + "type": "struct events::CollateralAssetPaused", + "concreteTypeId": "457cc10e18076b4e7a0ccc563fd089b256767bb56a148450f7e58f0d7cbf54ef", + "metadataTypeId": 13 + }, + { + "type": "struct events::CollateralAssetResumed", + "concreteTypeId": "81fb1b4fe81422099de81384a1f433aac8964b267aac0428e6bf423e46b88df9", + "metadataTypeId": 14 + }, + { + "type": "struct events::CollateralAssetUpdated", + "concreteTypeId": "6b698723a311c1005f7846d11d7ce209d68d00c120ee855364c14656ffb5b5a7", + "metadataTypeId": 15 + }, + { + "type": "struct events::MarketBasicEvent", + "concreteTypeId": "6a4af7c6d1aa3fedf33604a44da789ba359bf8f662a56fbc4de9603b8e732291", + "metadataTypeId": 16 + }, + { + "type": "struct events::MarketConfigurationEvent", + "concreteTypeId": "61d1473d8ec7f29c9b7f67ec6b840b973400d6af66df556a4fb5ea9884f780b7", + "metadataTypeId": 17 + }, + { + "type": "struct events::PauseConfigurationEvent", + "concreteTypeId": "ecf750cd9cc44add1b8fc9f1b11bb65d0981711b42c84d20aec21ef32bab7682", + "metadataTypeId": 18 + }, + { + "type": "struct events::ReservesWithdrawnEvent", + "concreteTypeId": "27b6995841bd520fff14deec990e8d66c03d8df59a510fa25e505694b0bc6ebe", + "metadataTypeId": 19 + }, + { + "type": "struct events::SetPythContractIdEvent", + "concreteTypeId": "d1ce69d85e3baf58b6bc7ebe55774b2c0ff63b955321139eece739000f91b995", + "metadataTypeId": 20 + }, + { + "type": "struct events::UserBasicEvent", + "concreteTypeId": "496e403bcde15a6d2d8a6ac3ae964a1db2145d27464fad7ae2b0dd4390c90c19", + "metadataTypeId": 21 + }, + { + "type": "struct events::UserLiquidatedEvent", + "concreteTypeId": "92d691781932f1848ba9433a9b1c09a97f985b331d88a1a289fc54569161d639", + "metadataTypeId": 22 + }, + { + "type": "struct events::UserSupplyBaseEvent", + "concreteTypeId": "1aed7a0722d2031e0bce0b49bb46e0f91a2237480a9d928eb696c7d1a6d7250c", + "metadataTypeId": 23 + }, + { + "type": "struct events::UserSupplyCollateralEvent", + "concreteTypeId": "61825e22a76ff7a0ca3ce1004c7d128c7844a8dde36cf7ea9077f8a57ef1f88a", + "metadataTypeId": 24 + }, + { + "type": "struct events::UserWithdrawBaseEvent", + "concreteTypeId": "3bbf66e44a782b08497502f3c67b5e181f14ef16755805fd800040f902019de1", + "metadataTypeId": 25 + }, + { + "type": "struct events::UserWithdrawCollateralEvent", + "concreteTypeId": "76ac511aac239f80b30e11716c2a730f0a814ea3acc85a13abb1777519465a4a", + "metadataTypeId": 26 + }, + { + "type": "struct market_abi::structs::CollateralConfiguration", + "concreteTypeId": "027212d4a883f4144f8043ef93fee6aa9d766041c7735fa37fae71d45ab6d92d", + "metadataTypeId": 27 + }, + { + "type": "struct market_abi::structs::MarketBasics", + "concreteTypeId": "8f0ca9732dda82407f3d36328a5e4b89421c5f1c404a9568afa856df6efb5802", + "metadataTypeId": 28 + }, + { + "type": "struct market_abi::structs::MarketConfiguration", + "concreteTypeId": "788c494dd193488709eb7174a5299c17819b0c2e68089b18e0474d616080cc9c", + "metadataTypeId": 29 + }, + { + "type": "struct market_abi::structs::PauseConfiguration", + "concreteTypeId": "8ec71ec402ef77ffda0627839b31dd1444fad8b4a95507e86bfa89f0517dbc3d", + "metadataTypeId": 30 + }, + { + "type": "struct market_abi::structs::PriceDataUpdate", + "concreteTypeId": "60b16a7d7d88977a17d1cbc5d1d741c4872c833abbe5cd6eaa5e2d741cd8bf19", + "metadataTypeId": 31 + }, + { + "type": "struct market_abi::structs::UserBasic", + "concreteTypeId": "2878312d8fe9af45fe59b9252d6afa651128c8f755ca8f26ae4d67ede06b8ea1", + "metadataTypeId": 32 + }, + { + "type": "struct pyth_interface::data_structures::price::Price", + "concreteTypeId": "8aba92fff7345309d4313706ed7db3a811609f62da8f0d2859819db43d461ff8", + "metadataTypeId": 33 + }, + { + "type": "struct std::asset_id::AssetId", + "concreteTypeId": "c0710b6731b1dd59799cf6bef33eee3b3b04a2e40e80a0724090215bbf2ca974", + "metadataTypeId": 35 + }, + { + "type": "struct std::bytes::Bytes", + "concreteTypeId": "cdd87b7d12fe505416570c294c884bca819364863efe3bf539245fa18515fbbb", + "metadataTypeId": 36 + }, + { + "type": "struct std::contract_id::ContractId", + "concreteTypeId": "29c10735d33b5159f0c71ee1dbd17b36a3e69e41f00fab0d42e1bd9f428d8a54", + "metadataTypeId": 38 + }, + { + "type": "struct std::vec::Vec<(struct std::asset_id::AssetId, u64)>", + "concreteTypeId": "d0540b5a00688e21ad7a3f5d7db93636c18f3ef7aed40d4e48f0cffc74683bcb", + "metadataTypeId": 40, + "typeArguments": [ + "229de6686c9c66098e7188f64d380a851d5ebacacaf90d991adf5b5952a70f7b" + ] + }, + { + "type": "struct std::vec::Vec", + "concreteTypeId": "2f79033d0d3729398611309f48578b56cf5162ba85e50f4d8fb79c9d9d1abc7b", + "metadataTypeId": 40, + "typeArguments": [ + "ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335" + ] + }, + { + "type": "struct std::vec::Vec", + "concreteTypeId": "135bedc713ecdc7e568f13811c40a9df6a62b44f54789c3f87066e7ccaedcc14", + "metadataTypeId": 40, + "typeArguments": [ + "027212d4a883f4144f8043ef93fee6aa9d766041c7735fa37fae71d45ab6d92d" + ] + }, + { + "type": "struct std::vec::Vec", + "concreteTypeId": "2601885b27af3627b8910876fc176d900cec2b16ec78c538f5f312e785d915f5", + "metadataTypeId": 40, + "typeArguments": [ + "cdd87b7d12fe505416570c294c884bca819364863efe3bf539245fa18515fbbb" + ] + }, + { + "type": "struct sway_libs::ownership::events::OwnershipRenounced", + "concreteTypeId": "43c4fa7b3297401afbf300127e59ea913e5c8f0c7ae69abbec789ab0bb872bed", + "metadataTypeId": 41 + }, + { + "type": "struct sway_libs::ownership::events::OwnershipSet", + "concreteTypeId": "e1ef35033ea9d2956f17c3292dea4a46ce7d61fdf37bbebe03b7b965073f43b5", + "metadataTypeId": 42 + }, + { + "type": "struct sway_libs::ownership::events::OwnershipTransferred", + "concreteTypeId": "b3fffbcb3158d7c010c31b194b60fb7857adb4ad61bdcf4b8b42958951d9f308", + "metadataTypeId": 43 + }, + { + "type": "struct sway_libs::signed_integers::i256::I256", + "concreteTypeId": "1c791a2f63a6d482f33e38564a4c4f67f2351f36419d0c750ce825e233c86ae1", + "metadataTypeId": 44 + }, + { + "type": "u256", + "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "type": "u64", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + }, + { + "type": "u8", + "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b" + } + ], + "metadataTypes": [ + { + "type": "(_, _)", + "metadataTypeId": 0, + "components": [ + { + "name": "__tuple_element", + "typeId": 35 + }, + { + "name": "__tuple_element", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ] + }, + { + "type": "(_, _)", + "metadataTypeId": 1, + "components": [ + { + "name": "__tuple_element", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "__tuple_element", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + } + ] + }, + { + "type": "enum market_abi::structs::Error", + "metadataTypeId": 2, + "components": [ + { + "name": "AlreadyInitialized", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "Paused", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "Unauthorized", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "InsufficientReserves", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "NotLiquidatable", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "NotForSale", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "TooMuchSlippage", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "SupplyCapExceeded", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "NotCollateralized", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "BorrowTooSmall", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "NotPermitted", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "InvalidPayment", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "UnknownAsset", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "DebuggingDisabled", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "NotYetActive", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "AlreadyActive", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "OracleContractIdNotSet", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "OraclePriceValidationError", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + } + ] + }, + { + "type": "enum standards::src5::AccessError", + "metadataTypeId": 3, + "components": [ + { + "name": "NotOwner", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + } + ] + }, + { + "type": "enum standards::src5::State", + "metadataTypeId": 4, + "components": [ + { + "name": "Uninitialized", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "name": "Initialized", + "typeId": 5 + }, + { + "name": "Revoked", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + } + ] + }, + { + "type": "enum std::identity::Identity", + "metadataTypeId": 5, + "components": [ + { + "name": "Address", + "typeId": 34 + }, + { + "name": "ContractId", + "typeId": 38 + } + ] + }, + { + "type": "enum sway_libs::ownership::errors::InitializationError", + "metadataTypeId": 6, + "components": [ + { + "name": "CannotReinitialized", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + } + ] + }, + { + "type": "enum sway_libs::reentrancy::errors::ReentrancyError", + "metadataTypeId": 7, + "components": [ + { + "name": "NonReentrant", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + } + ] + }, + { + "type": "generic T", + "metadataTypeId": 8 + }, + { + "type": "raw untyped ptr", + "metadataTypeId": 9 + }, + { + "type": "struct events::AbsorbCollateralEvent", + "metadataTypeId": 10, + "components": [ + { + "name": "account", + "typeId": 5 + }, + { + "name": "asset_id", + "typeId": 35 + }, + { + "name": "amount", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + }, + { + "name": "seize_value", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "decimals", + "typeId": 45 + } + ] + }, + { + "type": "struct events::BuyCollateralEvent", + "metadataTypeId": 11, + "components": [ + { + "name": "caller", + "typeId": 5 + }, + { + "name": "recipient", + "typeId": 5 + }, + { + "name": "asset_id", + "typeId": 35 + }, + { + "name": "amount", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + }, + { + "name": "price", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ] + }, + { + "type": "struct events::CollateralAssetAdded", + "metadataTypeId": 12, + "components": [ + { + "name": "asset_id", + "typeId": 35 + }, + { + "name": "configuration", + "typeId": 27 + } + ] + }, + { + "type": "struct events::CollateralAssetPaused", + "metadataTypeId": 13, + "components": [ + { + "name": "asset_id", + "typeId": 35 + } + ] + }, + { + "type": "struct events::CollateralAssetResumed", + "metadataTypeId": 14, + "components": [ + { + "name": "asset_id", + "typeId": 35 + } + ] + }, + { + "type": "struct events::CollateralAssetUpdated", + "metadataTypeId": 15, + "components": [ + { + "name": "asset_id", + "typeId": 35 + }, + { + "name": "configuration", + "typeId": 27 + } + ] + }, + { + "type": "struct events::MarketBasicEvent", + "metadataTypeId": 16, + "components": [ + { + "name": "market_basic", + "typeId": 28 + } + ] + }, + { + "type": "struct events::MarketConfigurationEvent", + "metadataTypeId": 17, + "components": [ + { + "name": "market_config", + "typeId": 29 + } + ] + }, + { + "type": "struct events::PauseConfigurationEvent", + "metadataTypeId": 18, + "components": [ + { + "name": "pause_config", + "typeId": 30 + } + ] + }, + { + "type": "struct events::ReservesWithdrawnEvent", + "metadataTypeId": 19, + "components": [ + { + "name": "caller", + "typeId": 5 + }, + { + "name": "to", + "typeId": 5 + }, + { + "name": "amount", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ] + }, + { + "type": "struct events::SetPythContractIdEvent", + "metadataTypeId": 20, + "components": [ + { + "name": "contract_id", + "typeId": 38 + } + ] + }, + { + "type": "struct events::UserBasicEvent", + "metadataTypeId": 21, + "components": [ + { + "name": "account", + "typeId": 5 + }, + { + "name": "user_basic", + "typeId": 32 + } + ] + }, + { + "type": "struct events::UserLiquidatedEvent", + "metadataTypeId": 22, + "components": [ + { + "name": "account", + "typeId": 5 + }, + { + "name": "liquidator", + "typeId": 5 + }, + { + "name": "base_paid_out", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "base_paid_out_value", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "total_base", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "total_base_value", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "decimals", + "typeId": 45 + } + ] + }, + { + "type": "struct events::UserSupplyBaseEvent", + "metadataTypeId": 23, + "components": [ + { + "name": "account", + "typeId": 5 + }, + { + "name": "supply_amount", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "repay_amount", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + } + ] + }, + { + "type": "struct events::UserSupplyCollateralEvent", + "metadataTypeId": 24, + "components": [ + { + "name": "account", + "typeId": 5 + }, + { + "name": "asset_id", + "typeId": 35 + }, + { + "name": "amount", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ] + }, + { + "type": "struct events::UserWithdrawBaseEvent", + "metadataTypeId": 25, + "components": [ + { + "name": "account", + "typeId": 5 + }, + { + "name": "withdraw_amount", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "borrow_amount", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + } + ] + }, + { + "type": "struct events::UserWithdrawCollateralEvent", + "metadataTypeId": 26, + "components": [ + { + "name": "account", + "typeId": 5 + }, + { + "name": "asset_id", + "typeId": 35 + }, + { + "name": "amount", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ] + }, + { + "type": "struct market_abi::structs::CollateralConfiguration", + "metadataTypeId": 27, + "components": [ + { + "name": "asset_id", + "typeId": 35 + }, + { + "name": "price_feed_id", + "typeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b" + }, + { + "name": "decimals", + "typeId": 45 + }, + { + "name": "borrow_collateral_factor", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "liquidate_collateral_factor", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "liquidation_penalty", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "supply_cap", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + }, + { + "name": "paused", + "typeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" + } + ] + }, + { + "type": "struct market_abi::structs::MarketBasics", + "metadataTypeId": 28, + "components": [ + { + "name": "base_supply_index", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "base_borrow_index", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "tracking_supply_index", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "tracking_borrow_index", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "total_supply_base", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "total_borrow_base", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "last_accrual_time", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + } + ] + }, + { + "type": "struct market_abi::structs::MarketConfiguration", + "metadataTypeId": 29, + "components": [ + { + "name": "base_token", + "typeId": 35 + }, + { + "name": "base_token_decimals", + "typeId": 45 + }, + { + "name": "base_token_price_feed_id", + "typeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b" + }, + { + "name": "supply_kink", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "borrow_kink", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "supply_per_second_interest_rate_slope_low", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "supply_per_second_interest_rate_slope_high", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "supply_per_second_interest_rate_base", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "borrow_per_second_interest_rate_slope_low", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "borrow_per_second_interest_rate_slope_high", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "borrow_per_second_interest_rate_base", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "store_front_price_factor", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "base_tracking_index_scale", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "base_tracking_supply_speed", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "base_tracking_borrow_speed", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "base_min_for_rewards", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "base_borrow_min", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "target_reserves", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + } + ] + }, + { + "type": "struct market_abi::structs::PauseConfiguration", + "metadataTypeId": 30, + "components": [ + { + "name": "supply_paused", + "typeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" + }, + { + "name": "withdraw_paused", + "typeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" + }, + { + "name": "absorb_paused", + "typeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" + }, + { + "name": "buy_paused", + "typeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" + } + ] + }, + { + "type": "struct market_abi::structs::PriceDataUpdate", + "metadataTypeId": 31, + "components": [ + { + "name": "update_fee", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + }, + { + "name": "publish_times", + "typeId": 40, + "typeArguments": [ + { + "name": "", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ] + }, + { + "name": "price_feed_ids", + "typeId": 40, + "typeArguments": [ + { + "name": "", + "typeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b" + } + ] + }, + { + "name": "update_data", + "typeId": 40, + "typeArguments": [ + { + "name": "", + "typeId": 36 + } + ] + } + ] + }, + { + "type": "struct market_abi::structs::UserBasic", + "metadataTypeId": 32, + "components": [ + { + "name": "principal", + "typeId": 44 + }, + { + "name": "base_tracking_index", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + }, + { + "name": "base_tracking_accrued", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + } + ] + }, + { + "type": "struct pyth_interface::data_structures::price::Price", + "metadataTypeId": 33, + "components": [ + { + "name": "confidence", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + }, + { + "name": "exponent", + "typeId": 45 + }, + { + "name": "price", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + }, + { + "name": "publish_time", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ] + }, + { + "type": "struct std::address::Address", + "metadataTypeId": 34, + "components": [ + { + "name": "bits", + "typeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b" + } + ] + }, + { + "type": "struct std::asset_id::AssetId", + "metadataTypeId": 35, + "components": [ + { + "name": "bits", + "typeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b" + } + ] + }, + { + "type": "struct std::bytes::Bytes", + "metadataTypeId": 36, + "components": [ + { + "name": "buf", + "typeId": 37 + }, + { + "name": "len", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ] + }, + { + "type": "struct std::bytes::RawBytes", + "metadataTypeId": 37, + "components": [ + { + "name": "ptr", + "typeId": 9 + }, + { + "name": "cap", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ] + }, + { + "type": "struct std::contract_id::ContractId", + "metadataTypeId": 38, + "components": [ + { + "name": "bits", + "typeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b" + } + ] + }, + { + "type": "struct std::vec::RawVec", + "metadataTypeId": 39, + "components": [ + { + "name": "ptr", + "typeId": 9 + }, + { + "name": "cap", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "typeParameters": [ + 8 + ] + }, + { + "type": "struct std::vec::Vec", + "metadataTypeId": 40, + "components": [ + { + "name": "buf", + "typeId": 39, + "typeArguments": [ + { + "name": "", + "typeId": 8 + } + ] + }, + { + "name": "len", + "typeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "typeParameters": [ + 8 + ] + }, + { + "type": "struct sway_libs::ownership::events::OwnershipRenounced", + "metadataTypeId": 41, + "components": [ + { + "name": "previous_owner", + "typeId": 5 + } + ] + }, + { + "type": "struct sway_libs::ownership::events::OwnershipSet", + "metadataTypeId": 42, + "components": [ + { + "name": "new_owner", + "typeId": 5 + } + ] + }, + { + "type": "struct sway_libs::ownership::events::OwnershipTransferred", + "metadataTypeId": 43, + "components": [ + { + "name": "new_owner", + "typeId": 5 + }, + { + "name": "previous_owner", + "typeId": 5 + } + ] + }, + { + "type": "struct sway_libs::signed_integers::i256::I256", + "metadataTypeId": 44, + "components": [ + { + "name": "underlying", + "typeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + } + ] + }, + { + "type": "u32", + "metadataTypeId": 45 + } + ], + "functions": [ + { + "inputs": [ + { + "name": "accounts", + "concreteTypeId": "2f79033d0d3729398611309f48578b56cf5162ba85e50f4d8fb79c9d9d1abc7b" + }, + { + "name": "price_data_update", + "concreteTypeId": "60b16a7d7d88977a17d1cbc5d1d741c4872c833abbe5cd6eaa5e2d741cd8bf19" + } + ], + "name": "absorb", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function absorbs a list of underwater accounts onto the protocol balance sheet." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `accounts`: [Vec] - The list of underwater accounts to be absorbed." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `price_data_update`: [PriceDataUpdate] - The price data update struct to be used for updating the price feeds." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `2 + accounts.len() * 4`" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `5 + accounts.len() * 5`" + ] + }, + { + "name": "payable", + "arguments": [] + }, + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "market_configuration", + "concreteTypeId": "788c494dd193488709eb7174a5299c17819b0c2e68089b18e0474d616080cc9c" + }, + { + "name": "owner", + "concreteTypeId": "ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335" + } + ], + "name": "activate_contract", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `market_configuration`: [MarketConfiguration] - The configuration settings for the market." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `owner`: [Identity] - The identity of the owner of the contract." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the contract is already active, indicated by a non-zero last accrual time." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `4`" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `2`" + ] + }, + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "configuration", + "concreteTypeId": "027212d4a883f4144f8043ef93fee6aa9d766041c7735fa37fae71d45ab6d92d" + } + ], + "name": "add_collateral_asset", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `configuration`: [CollateralConfiguration] - The collateral configuration to be added." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the caller is not the owner." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the asset already exists, indicated by a non-`None` value in the storage." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `2`" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "account", + "concreteTypeId": "ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335" + } + ], + "name": "available_to_borrow", + "output": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function calculates the amount of base asset a user can borrow based on their collateral and current borrow position." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `account`: [Identity] - The account of the user." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [u256] - The amount of base asset the user can borrow." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `4 + storage.collateral_configurations_keys.len() * 5`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "asset_id", + "concreteTypeId": "c0710b6731b1dd59799cf6bef33eee3b3b04a2e40e80a0724090215bbf2ca974" + } + ], + "name": "balance_of", + "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function retrieves the balance of a specified asset for the contract." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `asset_id`: [AssetId] - The asset ID of the asset whose balance is to be retrieved." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [u64] - The balance of the specified asset." + ] + } + ] + }, + { + "inputs": [ + { + "name": "asset_id", + "concreteTypeId": "c0710b6731b1dd59799cf6bef33eee3b3b04a2e40e80a0724090215bbf2ca974" + }, + { + "name": "min_amount", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + }, + { + "name": "recipient", + "concreteTypeId": "ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335" + } + ], + "name": "buy_collateral", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function allows buying collateral from the protocol. Prices are not updated here as the caller is expected to update them in the same transaction using a multicall handler." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `asset_id`: [AssetId] - The asset ID of the collateral asset to be bought." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `min_amount`: [u64] - The minimum amount of collateral to be bought." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `recipient`: [Identity] - The account of the recipient of the collateral." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the buy operation is paused." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When payment is not in the base token or the amount is zero." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When reserves are sufficient or not less than target reserves." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the quoted collateral amount is less than the minimum requested." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When collateral reserves are insufficient." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `8`" + ] + }, + { + "name": "payable", + "arguments": [] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "asset_id", + "concreteTypeId": "c0710b6731b1dd59799cf6bef33eee3b3b04a2e40e80a0724090215bbf2ca974" + }, + { + "name": "collateral_amount", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "name": "collateral_value_to_sell", + "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function calculates the base asset value for selling a collateral asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `asset_id`: [AssetId] - The asset ID of the collateral asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `collateral_amount`: [u64] - The amount of the collateral asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [u64] - The value of the collateral asset in base asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `5`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "debug_increment_timestamp", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function is useful for testing purposes, allowing developers to simulate time progression during debugging." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When `DEBUG_STEP` is not greater than zero, indicating that debugging is disabled." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `1`" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [], + "name": "get_all_totals_collateral", + "output": "d0540b5a00688e21ad7a3f5d7db93636c18f3ef7aed40d4e48f0cffc74683bcb", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function retrieves the total collateral amount for all collateral assets in the market." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [`Vec<(AssetId, u64)>`]: A list of tuples containing the asset ID and total collateral for each collateral asset" + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1 + storage.collateral_configurations_keys.len() * 2`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "account", + "concreteTypeId": "ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335" + } + ], + "name": "get_all_user_collateral", + "output": "d0540b5a00688e21ad7a3f5d7db93636c18f3ef7aed40d4e48f0cffc74683bcb", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function retrieves all collateral assets that a user has supplied, along with their respective amounts." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `account`: [Identity] - The account of the user." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [Vec<(AssetId, u64)>] - A list of tuples containing the asset ID and total collateral for each collateral asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `storage.collateral_configurations_keys.len()`" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1 + storage.collateral_configurations_keys.len() * 3`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "utilization", + "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + } + ], + "name": "get_borrow_rate", + "output": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function calculates the borrow rate based on the market's utilization. " + ] + }, + { + "name": "doc-comment", + "arguments": [ + " It uses different rates depending on whether the utilization is below or above the kink point." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `utilization`: [u256] - The utilization of the market." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [u256] - The borrow rate (decimals 18)." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `3 or 6`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "get_collateral_configurations", + "output": "135bedc713ecdc7e568f13811c40a9df6a62b44f54789c3f87066e7ccaedcc14", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function retrieves all collateral asset configurations in the market." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [Vec]: A list of collateral configurations" + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1 + storage.collateral_configurations_keys.len()`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "asset_id", + "concreteTypeId": "c0710b6731b1dd59799cf6bef33eee3b3b04a2e40e80a0724090215bbf2ca974" + } + ], + "name": "get_collateral_reserves", + "output": "1c791a2f63a6d482f33e38564a4c4f67f2351f36419d0c750ce825e233c86ae1", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function retrieves the reserves of a specified collateral asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `asset_id`: [AssetId] - The asset ID of the collateral asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [I256] - The reserves (in asset decimals)." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "get_market_basics", + "output": "8f0ca9732dda82407f3d36328a5e4b89421c5f1c404a9568afa856df6efb5802", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function retrieves the current market basic information." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [MarketBasics] - The market basic information." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "get_market_basics_with_interest", + "output": "8f0ca9732dda82407f3d36328a5e4b89421c5f1c404a9568afa856df6efb5802", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function retrieves the current market basic information, including accrued interest." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [MarketBasics] - The market basic information (with included interest)." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "get_market_configuration", + "output": "788c494dd193488709eb7174a5299c17819b0c2e68089b18e0474d616080cc9c", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function retrieves the current market configuration." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [MarketConfiguration] - The market configuration." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "get_pause_configuration", + "output": "8ec71ec402ef77ffda0627839b31dd1444fad8b4a95507e86bfa89f0517dbc3d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function retrieves the current pause configuration." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [PauseConfiguration] - The current pause configuration settings." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "price_feed_id", + "concreteTypeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b" + } + ], + "name": "get_price", + "output": "8aba92fff7345309d4313706ed7db3a811609f62da8f0d2859819db43d461ff8", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function ensures that the price data is fresh and meets the required validation criteria." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `price_feed_id`: [PriceFeedId] - The ID of the price feed for which the price is being retrieved." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [Price] - The price data retrieved from the oracle." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the `contract_id` is zero, indicating the oracle contract ID is not set." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the price is stale or ahead of the current timestamp." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the price is less than or equal to zero." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the confidence value exceeds the allowed width." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "get_pyth_contract_id", + "output": "29c10735d33b5159f0c71ee1dbd17b36a3e69e41f00fab0d42e1bd9f428d8a54", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function retrieves the contract ID of the Pyth contract." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [ContractId] - The contract ID of the Pyth contract." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "get_reserves", + "output": "1c791a2f63a6d482f33e38564a4c4f67f2351f36419d0c750ce825e233c86ae1", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function calculates and returns the total amount of protocol reserves of the base asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [I256] - The reserves of the base asset, expressed in base token decimals." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `3` (Reads market basic, market configuration, and current balance of the base token.)" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "utilization", + "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e" + } + ], + "name": "get_supply_rate", + "output": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function calculates the supply rate based on the market's utilization." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " It applies different rates depending on whether the utilization is below or above the kink point." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `utilization`: [u256] - The utilization of the market." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [u256] - The supply rate (decimals 18)." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `3 or 6`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "account", + "concreteTypeId": "ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335" + } + ], + "name": "get_user_balance_with_interest", + "output": "1c791a2f63a6d482f33e38564a4c4f67f2351f36419d0c750ce825e233c86ae1", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function retrieves the user's balance, including accrued interest." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `account`: [Identity] - The account of the user." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [I256] - The user balance (with included interest)." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "account", + "concreteTypeId": "ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335" + } + ], + "name": "get_user_basic", + "output": "2878312d8fe9af45fe59b9252d6afa651128c8f755ca8f26ae4d67ede06b8ea1", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function retrieves the basic information of a specified user." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `account`: [Identity] - The account of the user." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [UserBasic] - The user basic information." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "account", + "concreteTypeId": "ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335" + }, + { + "name": "asset_id", + "concreteTypeId": "c0710b6731b1dd59799cf6bef33eee3b3b04a2e40e80a0724090215bbf2ca974" + } + ], + "name": "get_user_collateral", + "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function retrieves the amount of collateral a user has supplied for a specific asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `account`: [Identity] - The account of the user." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `asset_id`: [AssetId] - The asset ID of the collateral asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [u64] - The amount of collateral the user has supplied for the specified asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "account", + "concreteTypeId": "ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335" + } + ], + "name": "get_user_supply_borrow", + "output": "2770d9f762bf8ec295d5c253193cd2897c893401f1f438769f92d212641ec779", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function retrieves the amount of base asset supplied and borrowed by a specific user." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `account`: [Identity] - The account of the user." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [u256] - The amount of base asset supplied by the user." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [u256] - The amount of base asset borrowed by the user." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " " + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `3`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "get_utilization", + "output": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function calculates the utilization of the market, defined as the ratio of total borrowed" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " amount to total supplied amount." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [u256] - The utilization of the market (decimals 18)." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: 1 (Reads market basic information)." + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "get_version", + "output": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " Get version of the smart contract" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [u8] - The version number of the smart contract." + ] + } + ] + }, + { + "inputs": [ + { + "name": "account", + "concreteTypeId": "ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335" + } + ], + "name": "is_liquidatable", + "output": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function checks if an account is liquidatable." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * account: [Identity] - The account to be checked." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [bool] - True if the account is liquidatable, False otherwise." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: 1" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "pause_config", + "concreteTypeId": "8ec71ec402ef77ffda0627839b31dd1444fad8b4a95507e86bfa89f0517dbc3d" + } + ], + "name": "pause", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function updates the pause configuration of the contract." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `pause_config`: [PauseConfiguration] - The pause configuration to be set." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the caller is not the owner." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "asset_id", + "concreteTypeId": "c0710b6731b1dd59799cf6bef33eee3b3b04a2e40e80a0724090215bbf2ca974" + } + ], + "name": "pause_collateral_asset", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `asset_id`: [AssetId] - The asset ID of the collateral asset to be paused." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the caller is not the owner." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `1`" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1` " + ] + }, + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "asset_id", + "concreteTypeId": "c0710b6731b1dd59799cf6bef33eee3b3b04a2e40e80a0724090215bbf2ca974" + }, + { + "name": "base_amount", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "name": "quote_collateral", + "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function calculates the quote for collateral by considering the asset price, base price, and discount factors based on the collateral configuration." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `asset_id`: [AssetId] - The asset ID of the collateral asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `base_amount`: [u64] - The amount of base asset for which the quote is requested." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [u64] - The quote for the collateral asset in exchange for the base asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the conversion from `u256` to `u64` fails due to overflow." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `2`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "renounce_ownership", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Additional Information" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " This action is irreversible and should be done with caution, as it removes all ownership privileges." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "asset_id", + "concreteTypeId": "c0710b6731b1dd59799cf6bef33eee3b3b04a2e40e80a0724090215bbf2ca974" + } + ], + "name": "resume_collateral_asset", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `asset_id`: [AssetId] - The asset ID of the collateral asset to be resumed." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the caller is not the owner." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `1`" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "contract_id", + "concreteTypeId": "29c10735d33b5159f0c71ee1dbd17b36a3e69e41f00fab0d42e1bd9f428d8a54" + } + ], + "name": "set_pyth_contract_id", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function sets the Pyth contract ID, allowing the contract to interact with the Pyth oracle." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments:" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `contract_id`: [ContractId] - The contract ID of the Pyth oracle to be set." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the caller is not the owner." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [], + "name": "supply_base", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function allows users to supply base assets to the market, updating their balance and the market's total supply." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " This function does not take any parameters directly, as it uses the message context to retrieve the amount and asset ID." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the supply is paused." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the supplied amount is less than or equal to zero." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the supplied asset is not the base asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `2`" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `4`" + ] + }, + { + "name": "payable", + "arguments": [] + }, + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [], + "name": "supply_collateral", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function ensures that the supplied collateral adheres to the market's rules and limits." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the supply is paused." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the supplied amount is less than or equal to zero." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the collateral asset is paused." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the total collateral exceeds the supply cap." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `2`" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `4`" + ] + }, + { + "name": "payable", + "arguments": [] + }, + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "asset_id", + "concreteTypeId": "c0710b6731b1dd59799cf6bef33eee3b3b04a2e40e80a0724090215bbf2ca974" + } + ], + "name": "totals_collateral", + "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function retrieves the total collateral amount for a specific asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `asset_id`: [AssetId] - The asset ID of the collateral asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [u64] - The total collateral ammount." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "new_owner", + "concreteTypeId": "ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335" + } + ], + "name": "transfer_ownership", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function allows the current owner to transfer ownership of the contract to a new owner." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `new_owner`: [Identity] - The identity of the new owner." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the caller is not the current owner." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "asset_id", + "concreteTypeId": "c0710b6731b1dd59799cf6bef33eee3b3b04a2e40e80a0724090215bbf2ca974" + }, + { + "name": "configuration", + "concreteTypeId": "027212d4a883f4144f8043ef93fee6aa9d766041c7735fa37fae71d45ab6d92d" + } + ], + "name": "update_collateral_asset", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `asset_id`: [AssetId] - The asset ID of the collateral asset to be updated." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `configuration`: [CollateralConfiguration] - The new collateral configuration." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the caller is not the owner." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the asset does not exist, indicated by a non-`Some` value in the storage." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `1`" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "update_data", + "concreteTypeId": "2601885b27af3627b8910876fc176d900cec2b16ec78c538f5f312e785d915f5" + } + ], + "name": "update_fee", + "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function interacts with an external oracle to obtain the update fee and ensures that the contract ID is valid." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `update_data`: [Vec] - The data used for the fee update request." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * [u64] - The update fee retrieved from the oracle." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the contract ID is not set (i.e., it is zero)." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "configuration", + "concreteTypeId": "788c494dd193488709eb7174a5299c17819b0c2e68089b18e0474d616080cc9c" + } + ], + "name": "update_market_configuration", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function updates the market configuration, allowing the owner to modify settings while preserving certain values." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `configuration`: [MarketConfiguration] - The new market configuration to be set." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the caller is not the owner." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `1`" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `2`" + ] + }, + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "price_data_update", + "concreteTypeId": "60b16a7d7d88977a17d1cbc5d1d741c4872c833abbe5cd6eaa5e2d741cd8bf19" + } + ], + "name": "update_price_feeds_if_necessary", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function ensures that the provided price data update is valid and performs an update if the conditions are met." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `price_data_update`: [PriceDataUpdate] - The data necessary for updating the price feeds." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Returns" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " This function does not return a value." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the contract ID is not set (i.e., it is zero)." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the payment amount is insufficient or the asset ID is not the base asset." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] + }, + { + "name": "payable", + "arguments": [] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [ + { + "name": "amount", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + }, + { + "name": "price_data_update", + "concreteTypeId": "60b16a7d7d88977a17d1cbc5d1d741c4872c833abbe5cd6eaa5e2d741cd8bf19" + } + ], + "name": "withdraw_base", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function allows users to withdraw a specified amount of base assets, potentially borrowing if necessary." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `amount`: [u64] - The amount of base asset to be withdrawn." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `price_data_update`: [PriceDataUpdate] - The price data update struct to be used for updating the price feeds." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the user is not collateralized." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `3`" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `5`" + ] + }, + { + "name": "payable", + "arguments": [] + }, + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "asset_id", + "concreteTypeId": "c0710b6731b1dd59799cf6bef33eee3b3b04a2e40e80a0724090215bbf2ca974" + }, + { + "name": "amount", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + }, + { + "name": "price_data_update", + "concreteTypeId": "60b16a7d7d88977a17d1cbc5d1d741c4872c833abbe5cd6eaa5e2d741cd8bf19" + } + ], + "name": "withdraw_collateral", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function ensures that the withdrawal adheres to the market's rules and checks for collateralization." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `asset_id`: [AssetId] - The asset ID of the collateral asset to be withdrawn." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `amount`: [u64] - The amount of collateral to be withdrawn." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `price_data_update`: [PriceDataUpdate] - The price data update struct to be used for updating the price feeds." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the user is not collateralized." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Writes: `2`" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `4`" + ] + }, + { + "name": "payable", + "arguments": [] + }, + { + "name": "storage", + "arguments": [ + "write" + ] + } + ] + }, + { + "inputs": [ + { + "name": "to", + "concreteTypeId": "ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335" + }, + { + "name": "amount", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "name": "withdraw_reserves", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ + { + "name": "doc-comment", + "arguments": [ + " This function allows the owner to withdraw a specified amount of reserves from the contract." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `to`: [Identity] - The account to which the reserves will be sent." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * `amount`: [u64] - The amount of reserves to be withdrawn." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the caller is not the owner." + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * When the amount requested exceeds the available reserves." + ] + }, + { + "name": "doc-comment", + "arguments": [ + "" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] + }, + { + "name": "doc-comment", + "arguments": [ + " * Reads: `4`" + ] + }, + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + }, + { + "inputs": [], + "name": "owner", + "output": "192bc7098e2fe60635a9918afb563e4e5419d386da2bdbf0d716b4bc8549802c", + "attributes": [ + { + "name": "storage", + "arguments": [ + "read" + ] + } + ] + } + ], + "loggedTypes": [ + { + "logId": "5557842539076482339", + "concreteTypeId": "4d216c57b3357523323f59401c7355785b41bdf832f6e1106272186b94797038" + }, + { + "logId": "5650517601072614705", + "concreteTypeId": "4e6aabd209068d31558291cfd07cff9366801b052a1767bd0a9eb34bf55e8a0e" + }, + { + "logId": "3591203286967623281", + "concreteTypeId": "31d6845ccbeb9e71f30bf07140659072ce92db76041efd6861d6895dace9e658" + }, + { + "logId": "5291237237808257645", + "concreteTypeId": "496e403bcde15a6d2d8a6ac3ae964a1db2145d27464fad7ae2b0dd4390c90c19" + }, + { + "logId": "7659206549590130669", + "concreteTypeId": "6a4af7c6d1aa3fedf33604a44da789ba359bf8f662a56fbc4de9603b8e732291" + }, + { + "logId": "10580804319558431108", + "concreteTypeId": "92d691781932f1848ba9433a9b1c09a97f985b331d88a1a289fc54569161d639" + }, + { + "logId": "2161305517876418151", + "concreteTypeId": "1dfe7feadc1d9667a4351761230f948744068a090fe91b1bc6763a90ed5d3893" + }, + { + "logId": "16280289466020123285", + "concreteTypeId": "e1ef35033ea9d2956f17c3292dea4a46ce7d61fdf37bbebe03b7b965073f43b5" + }, + { + "logId": "17075205356227152605", + "concreteTypeId": "ecf750cd9cc44add1b8fc9f1b11bb65d0981711b42c84d20aec21ef32bab7682" + }, + { + "logId": "7048493221525582492", + "concreteTypeId": "61d1473d8ec7f29c9b7f67ec6b840b973400d6af66df556a4fb5ea9884f780b7" + }, + { + "logId": "4571204900286667806", + "concreteTypeId": "3f702ea3351c9c1ece2b84048006c8034a24cbc2bad2e740d0412b4172951d3d" + }, + { + "logId": "16873461032230770227", + "concreteTypeId": "ea2a9368cd82d633fcc3411dbff6c25a78c7ccf550034427221102b74d7926db" + }, + { + "logId": "12201150593867749328", + "concreteTypeId": "a95331d2168897d0f550d1c4f7fc582926a79b3e825866ecf8c11ef8dfb692c6" + }, + { + "logId": "5007089152005991246", + "concreteTypeId": "457cc10e18076b4e7a0ccc563fd089b256767bb56a148450f7e58f0d7cbf54ef" + }, + { + "logId": "4883303303013154842", + "concreteTypeId": "43c4fa7b3297401afbf300127e59ea913e5c8f0c7ae69abbec789ab0bb872bed" + }, + { + "logId": "9366109880057078281", + "concreteTypeId": "81fb1b4fe81422099de81384a1f433aac8964b267aac0428e6bf423e46b88df9" + }, + { + "logId": "15118137377144155992", + "concreteTypeId": "d1ce69d85e3baf58b6bc7ebe55774b2c0ff63b955321139eece739000f91b995" + }, + { + "logId": "1940341185534100254", + "concreteTypeId": "1aed7a0722d2031e0bce0b49bb46e0f91a2237480a9d928eb696c7d1a6d7250c" + }, + { + "logId": "7026281871582427040", + "concreteTypeId": "61825e22a76ff7a0ca3ce1004c7d128c7844a8dde36cf7ea9077f8a57ef1f88a" + }, + { + "logId": "12970362301975156672", + "concreteTypeId": "b3fffbcb3158d7c010c31b194b60fb7857adb4ad61bdcf4b8b42958951d9f308" + }, + { + "logId": "7739866021742362880", + "concreteTypeId": "6b698723a311c1005f7846d11d7ce209d68d00c120ee855364c14656ffb5b5a7" + }, + { + "logId": "4305272899477449480", + "concreteTypeId": "3bbf66e44a782b08497502f3c67b5e181f14ef16755805fd800040f902019de1" + }, + { + "logId": "8551298967468744576", + "concreteTypeId": "76ac511aac239f80b30e11716c2a730f0a814ea3acc85a13abb1777519465a4a" + }, + { + "logId": "2861643217579627023", + "concreteTypeId": "27b6995841bd520fff14deec990e8d66c03d8df59a510fa25e505694b0bc6ebe" + } + ], + "messagesTypes": [], + "configurables": [ + { + "name": "DEBUG_STEP", + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "offset": 137368 + } + ] +}; + +const storageSlots: StorageSlot[] = [ + { + "key": "411f67b1bf136f1748de53161729ada89f0b6972b8783bcd860925d7cfddceba", + "value": "00000000000000000000000000000000000000000000000000038d7ea4c68000" + }, + { + "key": "411f67b1bf136f1748de53161729ada89f0b6972b8783bcd860925d7cfddcebb", + "value": "00000000000000000000000000000000000000000000000000038d7ea4c68000" + }, + { + "key": "411f67b1bf136f1748de53161729ada89f0b6972b8783bcd860925d7cfddcebc", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "411f67b1bf136f1748de53161729ada89f0b6972b8783bcd860925d7cfddcebd", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "411f67b1bf136f1748de53161729ada89f0b6972b8783bcd860925d7cfddcebe", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "411f67b1bf136f1748de53161729ada89f0b6972b8783bcd860925d7cfddcebf", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "411f67b1bf136f1748de53161729ada89f0b6972b8783bcd860925d7cfddcec0", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d432", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d433", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d434", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d435", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d436", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d437", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d438", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d439", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d43a", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d43b", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d43c", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d43d", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d43e", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d43f", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d440", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d441", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d442", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "7b867e531e60dfad72c6b3543afcdc72cf783abc1c4f59c0c55ab5aec5f9d443", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "9e39cce573e16c4eb034ec33f6641ef797822070b45760ef0edafbb57a145b1d", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "c9f05e40a03436c822e78a416687947db653880f61c7e4a00ec4059ee20c3cbd", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + }, + { + "key": "e4e26847100238d6956b2dc2c3f81418d1c06748ea6e7f97bc1c1adb91925ecc", + "value": "0100000000000000010000000000000001000000000000000100000000000000" + } +]; + +export class MarketInterface extends Interface { + constructor() { + super(abi); + } + + declare functions: { + absorb: FunctionFragment; + activate_contract: FunctionFragment; + add_collateral_asset: FunctionFragment; + available_to_borrow: FunctionFragment; + balance_of: FunctionFragment; + buy_collateral: FunctionFragment; + collateral_value_to_sell: FunctionFragment; + debug_increment_timestamp: FunctionFragment; + get_all_totals_collateral: FunctionFragment; + get_all_user_collateral: FunctionFragment; + get_borrow_rate: FunctionFragment; + get_collateral_configurations: FunctionFragment; + get_collateral_reserves: FunctionFragment; + get_market_basics: FunctionFragment; + get_market_basics_with_interest: FunctionFragment; + get_market_configuration: FunctionFragment; + get_pause_configuration: FunctionFragment; + get_price: FunctionFragment; + get_pyth_contract_id: FunctionFragment; + get_reserves: FunctionFragment; + get_supply_rate: FunctionFragment; + get_user_balance_with_interest: FunctionFragment; + get_user_basic: FunctionFragment; + get_user_collateral: FunctionFragment; + get_user_supply_borrow: FunctionFragment; + get_utilization: FunctionFragment; + get_version: FunctionFragment; + is_liquidatable: FunctionFragment; + pause: FunctionFragment; + pause_collateral_asset: FunctionFragment; + quote_collateral: FunctionFragment; + renounce_ownership: FunctionFragment; + resume_collateral_asset: FunctionFragment; + set_pyth_contract_id: FunctionFragment; + supply_base: FunctionFragment; + supply_collateral: FunctionFragment; + totals_collateral: FunctionFragment; + transfer_ownership: FunctionFragment; + update_collateral_asset: FunctionFragment; + update_fee: FunctionFragment; + update_market_configuration: FunctionFragment; + update_price_feeds_if_necessary: FunctionFragment; + withdraw_base: FunctionFragment; + withdraw_collateral: FunctionFragment; + withdraw_reserves: FunctionFragment; + owner: FunctionFragment; + }; +} + +export class Market extends Contract { + static readonly abi = abi; + static readonly storageSlots = storageSlots; + + declare interface: MarketInterface; + declare functions: { + absorb: InvokeFunction<[accounts: Vec, price_data_update: PriceDataUpdateInput], void>; + activate_contract: InvokeFunction<[market_configuration: MarketConfigurationInput, owner: IdentityInput], void>; + add_collateral_asset: InvokeFunction<[configuration: CollateralConfigurationInput], void>; + available_to_borrow: InvokeFunction<[account: IdentityInput], BN>; + balance_of: InvokeFunction<[asset_id: AssetIdInput], BN>; + buy_collateral: InvokeFunction<[asset_id: AssetIdInput, min_amount: BigNumberish, recipient: IdentityInput], void>; + collateral_value_to_sell: InvokeFunction<[asset_id: AssetIdInput, collateral_amount: BigNumberish], BN>; + debug_increment_timestamp: InvokeFunction<[], void>; + get_all_totals_collateral: InvokeFunction<[], Vec<[AssetIdOutput, BN]>>; + get_all_user_collateral: InvokeFunction<[account: IdentityInput], Vec<[AssetIdOutput, BN]>>; + get_borrow_rate: InvokeFunction<[utilization: BigNumberish], BN>; + get_collateral_configurations: InvokeFunction<[], Vec>; + get_collateral_reserves: InvokeFunction<[asset_id: AssetIdInput], I256Output>; + get_market_basics: InvokeFunction<[], MarketBasicsOutput>; + get_market_basics_with_interest: InvokeFunction<[], MarketBasicsOutput>; + get_market_configuration: InvokeFunction<[], MarketConfigurationOutput>; + get_pause_configuration: InvokeFunction<[], PauseConfigurationOutput>; + get_price: InvokeFunction<[price_feed_id: string], PriceOutput>; + get_pyth_contract_id: InvokeFunction<[], ContractIdOutput>; + get_reserves: InvokeFunction<[], I256Output>; + get_supply_rate: InvokeFunction<[utilization: BigNumberish], BN>; + get_user_balance_with_interest: InvokeFunction<[account: IdentityInput], I256Output>; + get_user_basic: InvokeFunction<[account: IdentityInput], UserBasicOutput>; + get_user_collateral: InvokeFunction<[account: IdentityInput, asset_id: AssetIdInput], BN>; + get_user_supply_borrow: InvokeFunction<[account: IdentityInput], [BN, BN]>; + get_utilization: InvokeFunction<[], BN>; + get_version: InvokeFunction<[], number>; + is_liquidatable: InvokeFunction<[account: IdentityInput], boolean>; + pause: InvokeFunction<[pause_config: PauseConfigurationInput], void>; + pause_collateral_asset: InvokeFunction<[asset_id: AssetIdInput], void>; + quote_collateral: InvokeFunction<[asset_id: AssetIdInput, base_amount: BigNumberish], BN>; + renounce_ownership: InvokeFunction<[], void>; + resume_collateral_asset: InvokeFunction<[asset_id: AssetIdInput], void>; + set_pyth_contract_id: InvokeFunction<[contract_id: ContractIdInput], void>; + supply_base: InvokeFunction<[], void>; + supply_collateral: InvokeFunction<[], void>; + totals_collateral: InvokeFunction<[asset_id: AssetIdInput], BN>; + transfer_ownership: InvokeFunction<[new_owner: IdentityInput], void>; + update_collateral_asset: InvokeFunction<[asset_id: AssetIdInput, configuration: CollateralConfigurationInput], void>; + update_fee: InvokeFunction<[update_data: Vec], BN>; + update_market_configuration: InvokeFunction<[configuration: MarketConfigurationInput], void>; + update_price_feeds_if_necessary: InvokeFunction<[price_data_update: PriceDataUpdateInput], void>; + withdraw_base: InvokeFunction<[amount: BigNumberish, price_data_update: PriceDataUpdateInput], void>; + withdraw_collateral: InvokeFunction<[asset_id: AssetIdInput, amount: BigNumberish, price_data_update: PriceDataUpdateInput], void>; + withdraw_reserves: InvokeFunction<[to: IdentityInput, amount: BigNumberish], void>; + owner: InvokeFunction<[], StateOutput>; + }; + + constructor( + id: string | AbstractAddress, + accountOrProvider: Account | Provider, + ) { + super(id, abi, accountOrProvider); + } +} \ No newline at end of file diff --git a/src/types/common.ts b/src/types/common.ts new file mode 100644 index 0000000..1a5e78b --- /dev/null +++ b/src/types/common.ts @@ -0,0 +1,17 @@ +export type Enum = { + [K in keyof T]: Pick & { [P in Exclude]?: never }; + }[keyof T]; + + /** + * Mimics Sway Option and Vectors. + * Vectors are treated like arrays in Typescript. + */ + export type Option = T | undefined; + + export type Vec = T[]; + + /** + * Mimics Sway Result enum type. + * Ok represents the success case, while Err represents the error case. + */ + export type Result = Enum<{Ok: T, Err: E}>; \ No newline at end of file From 0dee2858ba5647b75983fe7aa1f6b6c8cba1d25d Mon Sep 17 00:00:00 2001 From: viraj124 Date: Thu, 19 Dec 2024 21:58:48 +0530 Subject: [PATCH 2/2] chore: add deposit test --- test/deposit.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 test/deposit.test.ts diff --git a/test/deposit.test.ts b/test/deposit.test.ts new file mode 100644 index 0000000..420b138 --- /dev/null +++ b/test/deposit.test.ts @@ -0,0 +1,11 @@ +import { test } from 'vitest'; +import { FuelAgent } from '../src/FuelAgent.js'; +import { supplyCollateral } from '../src/tools.js'; + +test('supplyCollateral', async () => { + const tx = await supplyCollateral({ + amount: 1, + symbol: 'USDT', + }); + console.log("TX", tx); +});