From a9018d773a0fe02a97b0415a6ba7c4ff5c75c7c3 Mon Sep 17 00:00:00 2001 From: Ugo-X Date: Thu, 22 Aug 2024 13:25:24 +0100 Subject: [PATCH 1/6] Integrated Vesu.xyz protocol --- .husky/_/h | 0 src/store/pools.ts | 6 +++ src/store/vesu.store.ts | 115 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+) mode change 100755 => 100644 .husky/_/h create mode 100644 src/store/vesu.store.ts diff --git a/.husky/_/h b/.husky/_/h old mode 100755 new mode 100644 diff --git a/src/store/pools.ts b/src/store/pools.ts index 9c9b5d38..df67605b 100755 --- a/src/store/pools.ts +++ b/src/store/pools.ts @@ -15,6 +15,7 @@ import StarkDefiAtoms, { starkDefi } from './starkdefi.store'; import TenkSwapAtoms, { tenkswap } from './tenkswap.store'; import ZkLendAtoms, { zkLend } from './zklend.store'; import CarmineAtoms, { carmine } from './carmine.store'; +import VesuAtoms, { Vesu } from './vesu.store'; export enum Category { Stable = 'Stable Pools', @@ -75,6 +76,11 @@ export const PROTOCOLS = [ class: ekubo, atoms: EkuboAtoms, }, + { + name: Vesu.name, + class: Vesu, + atoms: VesuAtoms, + }, { name: jedi.name, class: jedi, diff --git a/src/store/vesu.store.ts b/src/store/vesu.store.ts new file mode 100644 index 00000000..d4f4896e --- /dev/null +++ b/src/store/vesu.store.ts @@ -0,0 +1,115 @@ +import CONSTANTS, { TokenName } from '@/constants'; +import { Category, PoolType } from './pools'; +import { atom } from 'jotai'; +import { PoolInfo, ProtocolAtoms } from './pools'; +import { Jediswap } from './jedi.store'; + +// The Vesu Pool data is hartdcoded here as there is no api and there's a lot of calculations made into finding the apy values for each of thier pool. these values gotten are put into the data array below. + +const poolsData = [ + { + id: 'ETH', + isVesu: true, + tokenA: 'ETH', + baseApr: '0.0000305', + rewardApr: '0.09', + tvl: '1000000', + }, + { + id: 'STRK', + isVesu: true, + tokenA: 'STRK', + baseApr: '0.0000074', + rewardApr: '0.13', + tvl: '2000000', + }, + { + id: 'USDC', + isVesu: true, + tokenA: 'USDC', + baseApr: '0.000245', + rewardApr: '0.10', + tvl: '2000000', + }, + { + id: 'USDT', + isVesu: true, + tokenA: 'USDT', + baseApr: '0.000917', + rewardApr: '0.10', + tvl: '2000000', + }, +]; + +export class Vesu extends Jediswap { + name = 'Vesu.xyz'; + link = 'https://www.vesu.xyz/markets'; + logo = + 'https://github.com/vesuxyz/assets/blob/main/logo/logo_hi-res_light-mode.png'; + incentiveDataKey = 'isVesu'; + + _computePoolsInfo() { + try { + const pools: PoolInfo[] = []; + poolsData + .filter((poolData) => poolData.isVesu) + .forEach((poolData) => { + const category = Category.Stable; + const tokens: TokenName[] = [poolData.tokenA] as TokenName[]; + const logo1 = CONSTANTS.LOGOS[tokens[0]]; + const baseApr = + poolData.baseApr === '0' ? 0.0 : parseFloat(poolData.baseApr); + const rewardApr = parseFloat(poolData.rewardApr); + const poolInfo: PoolInfo = { + pool: { + name: poolData.id, + logos: [logo1], + }, + protocol: { + name: this.name, + link: this.link, + logo: this.logo, + }, + apr: baseApr + rewardApr, + tvl: Number(poolData.tvl), + aprSplits: [ + { + apr: baseApr, + title: 'Base APR', + description: '', + }, + { + apr: rewardApr, + title: 'Reward APR', + description: '', + }, + ], + category, + type: PoolType.DEXV2, + lending: { + collateralFactor: 0, + }, + borrow: { + borrowFactor: 0, + apr: 0, + }, + }; + pools.push(poolInfo); + }); + return pools; + } catch (err) { + console.error('Err computing pools', err); + throw err; + } + } +} + +export const vesu = new Vesu(); + +const VesuAtoms: ProtocolAtoms = { + pools: atom(() => { + return vesu._computePoolsInfo(); + }), +}; + +export default VesuAtoms; From 154b62bb0a0f9aa465063119afe793c928b0a597 Mon Sep 17 00:00:00 2001 From: Ugo-X Date: Wed, 28 Aug 2024 02:52:57 +0100 Subject: [PATCH 2/6] updated PR --- src/store/vesu.abi.json | 1903 ++++++++++++++++++++++++++ src/store/vesu.store.ts | 118 +- src/store/vesuInterestRate.abi.json | 1946 +++++++++++++++++++++++++++ 3 files changed, 3955 insertions(+), 12 deletions(-) create mode 100644 src/store/vesu.abi.json create mode 100644 src/store/vesuInterestRate.abi.json diff --git a/src/store/vesu.abi.json b/src/store/vesu.abi.json new file mode 100644 index 00000000..b09b27d7 --- /dev/null +++ b/src/store/vesu.abi.json @@ -0,0 +1,1903 @@ +[ + { + "name": "SingletonImpl", + "type": "impl", + "interface_name": "vesu::singleton::ISingleton" + }, + { + "name": "core::integer::u256", + "type": "struct", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "name": "core::bool", + "type": "enum", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "name": "vesu::data_model::AssetConfig", + "type": "struct", + "members": [ + { + "name": "total_collateral_shares", + "type": "core::integer::u256" + }, + { + "name": "total_nominal_debt", + "type": "core::integer::u256" + }, + { + "name": "reserve", + "type": "core::integer::u256" + }, + { + "name": "max_utilization", + "type": "core::integer::u256" + }, + { + "name": "floor", + "type": "core::integer::u256" + }, + { + "name": "scale", + "type": "core::integer::u256" + }, + { + "name": "is_legacy", + "type": "core::bool" + }, + { + "name": "last_updated", + "type": "core::integer::u64" + }, + { + "name": "last_rate_accumulator", + "type": "core::integer::u256" + }, + { + "name": "last_full_utilization_rate", + "type": "core::integer::u256" + }, + { + "name": "fee_rate", + "type": "core::integer::u256" + } + ] + }, + { + "name": "vesu::data_model::LTVConfig", + "type": "struct", + "members": [ + { + "name": "max_ltv", + "type": "core::integer::u64" + } + ] + }, + { + "name": "vesu::data_model::Position", + "type": "struct", + "members": [ + { + "name": "collateral_shares", + "type": "core::integer::u256" + }, + { + "name": "nominal_debt", + "type": "core::integer::u256" + } + ] + }, + { + "name": "alexandria_math::i257::i257", + "type": "struct", + "members": [ + { + "name": "abs", + "type": "core::integer::u256" + }, + { + "name": "is_negative", + "type": "core::bool" + } + ] + }, + { + "name": "vesu::data_model::AmountType", + "type": "enum", + "variants": [ + { + "name": "Delta", + "type": "()" + }, + { + "name": "Target", + "type": "()" + } + ] + }, + { + "name": "vesu::data_model::AmountDenomination", + "type": "enum", + "variants": [ + { + "name": "Native", + "type": "()" + }, + { + "name": "Assets", + "type": "()" + } + ] + }, + { + "name": "vesu::data_model::Amount", + "type": "struct", + "members": [ + { + "name": "amount_type", + "type": "vesu::data_model::AmountType" + }, + { + "name": "denomination", + "type": "vesu::data_model::AmountDenomination" + }, + { + "name": "value", + "type": "alexandria_math::i257::i257" + } + ] + }, + { + "name": "vesu::data_model::AssetPrice", + "type": "struct", + "members": [ + { + "name": "value", + "type": "core::integer::u256" + }, + { + "name": "is_valid", + "type": "core::bool" + } + ] + }, + { + "name": "vesu::data_model::Context", + "type": "struct", + "members": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "extension", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral_asset_config", + "type": "vesu::data_model::AssetConfig" + }, + { + "name": "debt_asset_config", + "type": "vesu::data_model::AssetConfig" + }, + { + "name": "collateral_asset_price", + "type": "vesu::data_model::AssetPrice" + }, + { + "name": "debt_asset_price", + "type": "vesu::data_model::AssetPrice" + }, + { + "name": "collateral_asset_fee_shares", + "type": "core::integer::u256" + }, + { + "name": "debt_asset_fee_shares", + "type": "core::integer::u256" + }, + { + "name": "max_ltv", + "type": "core::integer::u64" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "position", + "type": "vesu::data_model::Position" + } + ] + }, + { + "name": "vesu::data_model::AssetParams", + "type": "struct", + "members": [ + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "floor", + "type": "core::integer::u256" + }, + { + "name": "initial_rate_accumulator", + "type": "core::integer::u256" + }, + { + "name": "initial_full_utilization_rate", + "type": "core::integer::u256" + }, + { + "name": "max_utilization", + "type": "core::integer::u256" + }, + { + "name": "is_legacy", + "type": "core::bool" + }, + { + "name": "fee_rate", + "type": "core::integer::u256" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "vesu::data_model::LTVParams", + "type": "struct", + "members": [ + { + "name": "collateral_asset_index", + "type": "core::integer::u32" + }, + { + "name": "debt_asset_index", + "type": "core::integer::u32" + }, + { + "name": "max_ltv", + "type": "core::integer::u64" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "vesu::data_model::ModifyPositionParams", + "type": "struct", + "members": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral", + "type": "vesu::data_model::Amount" + }, + { + "name": "debt", + "type": "vesu::data_model::Amount" + }, + { + "name": "data", + "type": "core::array::Span::" + } + ] + }, + { + "name": "vesu::data_model::UpdatePositionResponse", + "type": "struct", + "members": [ + { + "name": "collateral_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "collateral_shares_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "nominal_debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "bad_debt", + "type": "core::integer::u256" + } + ] + }, + { + "name": "vesu::data_model::UnsignedAmount", + "type": "struct", + "members": [ + { + "name": "amount_type", + "type": "vesu::data_model::AmountType" + }, + { + "name": "denomination", + "type": "vesu::data_model::AmountDenomination" + }, + { + "name": "value", + "type": "core::integer::u256" + } + ] + }, + { + "name": "vesu::data_model::TransferPositionParams", + "type": "struct", + "members": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "from_collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "from_debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "to_collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "to_debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "from_user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "to_user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral", + "type": "vesu::data_model::UnsignedAmount" + }, + { + "name": "debt", + "type": "vesu::data_model::UnsignedAmount" + }, + { + "name": "from_data", + "type": "core::array::Span::" + }, + { + "name": "to_data", + "type": "core::array::Span::" + } + ] + }, + { + "name": "vesu::data_model::LiquidatePositionParams", + "type": "struct", + "members": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "receive_as_shares", + "type": "core::bool" + }, + { + "name": "data", + "type": "core::array::Span::" + } + ] + }, + { + "name": "vesu::singleton::ISingleton", + "type": "interface", + "items": [ + { + "name": "creator_nonce", + "type": "function", + "inputs": [ + { + "name": "creator", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "extension", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "name": "asset_config_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(vesu::data_model::AssetConfig, core::integer::u256)" + } + ], + "state_mutability": "view" + }, + { + "name": "asset_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(vesu::data_model::AssetConfig, core::integer::u256)" + } + ], + "state_mutability": "external" + }, + { + "name": "ltv_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::data_model::LTVConfig" + } + ], + "state_mutability": "view" + }, + { + "name": "position_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(vesu::data_model::Position, core::integer::u256, core::integer::u256)" + } + ], + "state_mutability": "view" + }, + { + "name": "position", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(vesu::data_model::Position, core::integer::u256, core::integer::u256)" + } + ], + "state_mutability": "external" + }, + { + "name": "check_collateralization_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(core::bool, core::integer::u256, core::integer::u256)" + } + ], + "state_mutability": "view" + }, + { + "name": "check_collateralization", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(core::bool, core::integer::u256, core::integer::u256)" + } + ], + "state_mutability": "external" + }, + { + "name": "rate_accumulator_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "rate_accumulator", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "external" + }, + { + "name": "utilization_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "utilization", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "external" + }, + { + "name": "delegation", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "delegator", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "delegatee", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "name": "calculate_pool_id", + "type": "function", + "inputs": [ + { + "name": "caller_address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "nonce", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "calculate_debt", + "type": "function", + "inputs": [ + { + "name": "nominal_debt", + "type": "alexandria_math::i257::i257" + }, + { + "name": "rate_accumulator", + "type": "core::integer::u256" + }, + { + "name": "asset_scale", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "calculate_nominal_debt", + "type": "function", + "inputs": [ + { + "name": "debt", + "type": "alexandria_math::i257::i257" + }, + { + "name": "rate_accumulator", + "type": "core::integer::u256" + }, + { + "name": "asset_scale", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "calculate_collateral_shares_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral", + "type": "alexandria_math::i257::i257" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "calculate_collateral_shares", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral", + "type": "alexandria_math::i257::i257" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "external" + }, + { + "name": "calculate_collateral_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral_shares", + "type": "alexandria_math::i257::i257" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "calculate_collateral", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral_shares", + "type": "alexandria_math::i257::i257" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "external" + }, + { + "name": "deconstruct_collateral_amount_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral", + "type": "vesu::data_model::Amount" + } + ], + "outputs": [ + { + "type": "(alexandria_math::i257::i257, alexandria_math::i257::i257)" + } + ], + "state_mutability": "view" + }, + { + "name": "deconstruct_collateral_amount", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral", + "type": "vesu::data_model::Amount" + } + ], + "outputs": [ + { + "type": "(alexandria_math::i257::i257, alexandria_math::i257::i257)" + } + ], + "state_mutability": "external" + }, + { + "name": "deconstruct_debt_amount_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt", + "type": "vesu::data_model::Amount" + } + ], + "outputs": [ + { + "type": "(alexandria_math::i257::i257, alexandria_math::i257::i257)" + } + ], + "state_mutability": "view" + }, + { + "name": "deconstruct_debt_amount", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt", + "type": "vesu::data_model::Amount" + } + ], + "outputs": [ + { + "type": "(alexandria_math::i257::i257, alexandria_math::i257::i257)" + } + ], + "state_mutability": "external" + }, + { + "name": "context_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::data_model::Context" + } + ], + "state_mutability": "view" + }, + { + "name": "context", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::data_model::Context" + } + ], + "state_mutability": "external" + }, + { + "name": "create_pool", + "type": "function", + "inputs": [ + { + "name": "asset_params", + "type": "core::array::Span::" + }, + { + "name": "ltv_params", + "type": "core::array::Span::" + }, + { + "name": "extension", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "name": "modify_position", + "type": "function", + "inputs": [ + { + "name": "params", + "type": "vesu::data_model::ModifyPositionParams" + } + ], + "outputs": [ + { + "type": "vesu::data_model::UpdatePositionResponse" + } + ], + "state_mutability": "external" + }, + { + "name": "transfer_position", + "type": "function", + "inputs": [ + { + "name": "params", + "type": "vesu::data_model::TransferPositionParams" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "liquidate_position", + "type": "function", + "inputs": [ + { + "name": "params", + "type": "vesu::data_model::LiquidatePositionParams" + } + ], + "outputs": [ + { + "type": "vesu::data_model::UpdatePositionResponse" + } + ], + "state_mutability": "external" + }, + { + "name": "flash_loan", + "type": "function", + "inputs": [ + { + "name": "receiver", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + }, + { + "name": "is_legacy", + "type": "core::bool" + }, + { + "name": "data", + "type": "core::array::Span::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "modify_delegation", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "delegatee", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "delegation", + "type": "core::bool" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "donate_to_reserve", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "retrieve_from_reserve", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "receiver", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_asset_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "params", + "type": "vesu::data_model::AssetParams" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_ltv_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "ltv_config", + "type": "vesu::data_model::LTVConfig" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_asset_parameter", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "parameter", + "type": "core::felt252" + }, + { + "name": "value", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_extension", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "extension", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "claim_fee_shares", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::CreatePool", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "extension", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "creator", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::ModifyPosition", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "collateral_delta", + "type": "alexandria_math::i257::i257" + }, + { + "kind": "data", + "name": "collateral_shares_delta", + "type": "alexandria_math::i257::i257" + }, + { + "kind": "data", + "name": "debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "kind": "data", + "name": "nominal_debt_delta", + "type": "alexandria_math::i257::i257" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::TransferPosition", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "from_collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "from_debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "to_collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "to_debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "from_user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "to_user", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::LiquidatePosition", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "liquidator", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "collateral_delta", + "type": "alexandria_math::i257::i257" + }, + { + "kind": "data", + "name": "collateral_shares_delta", + "type": "alexandria_math::i257::i257" + }, + { + "kind": "data", + "name": "debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "kind": "data", + "name": "nominal_debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "kind": "data", + "name": "bad_debt", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::AccrueFees", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "fee_shares", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::UpdateContext", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "collateral_asset_config", + "type": "vesu::data_model::AssetConfig" + }, + { + "kind": "data", + "name": "debt_asset_config", + "type": "vesu::data_model::AssetConfig" + }, + { + "kind": "data", + "name": "collateral_asset_price", + "type": "vesu::data_model::AssetPrice" + }, + { + "kind": "data", + "name": "debt_asset_price", + "type": "vesu::data_model::AssetPrice" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::Flashloan", + "type": "event", + "members": [ + { + "kind": "key", + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "receiver", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "amount", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::ModifyDelegation", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "delegator", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "delegatee", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "delegation", + "type": "core::bool" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::Donate", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "amount", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::RetrieveReserve", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "receiver", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::SetLTVConfig", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "ltv_config", + "type": "vesu::data_model::LTVConfig" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::SetAssetConfig", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::SetAssetParameter", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "parameter", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "value", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::SetExtension", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "extension", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "enum", + "name": "vesu::singleton::Singleton::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "CreatePool", + "type": "vesu::singleton::Singleton::CreatePool" + }, + { + "kind": "nested", + "name": "ModifyPosition", + "type": "vesu::singleton::Singleton::ModifyPosition" + }, + { + "kind": "nested", + "name": "TransferPosition", + "type": "vesu::singleton::Singleton::TransferPosition" + }, + { + "kind": "nested", + "name": "LiquidatePosition", + "type": "vesu::singleton::Singleton::LiquidatePosition" + }, + { + "kind": "nested", + "name": "AccrueFees", + "type": "vesu::singleton::Singleton::AccrueFees" + }, + { + "kind": "nested", + "name": "UpdateContext", + "type": "vesu::singleton::Singleton::UpdateContext" + }, + { + "kind": "nested", + "name": "Flashloan", + "type": "vesu::singleton::Singleton::Flashloan" + }, + { + "kind": "nested", + "name": "ModifyDelegation", + "type": "vesu::singleton::Singleton::ModifyDelegation" + }, + { + "kind": "nested", + "name": "Donate", + "type": "vesu::singleton::Singleton::Donate" + }, + { + "kind": "nested", + "name": "RetrieveReserve", + "type": "vesu::singleton::Singleton::RetrieveReserve" + }, + { + "kind": "nested", + "name": "SetLTVConfig", + "type": "vesu::singleton::Singleton::SetLTVConfig" + }, + { + "kind": "nested", + "name": "SetAssetConfig", + "type": "vesu::singleton::Singleton::SetAssetConfig" + }, + { + "kind": "nested", + "name": "SetAssetParameter", + "type": "vesu::singleton::Singleton::SetAssetParameter" + }, + { + "kind": "nested", + "name": "SetExtension", + "type": "vesu::singleton::Singleton::SetExtension" + } + ] + } +] \ No newline at end of file diff --git a/src/store/vesu.store.ts b/src/store/vesu.store.ts index d4f4896e..2e6df22c 100644 --- a/src/store/vesu.store.ts +++ b/src/store/vesu.store.ts @@ -3,44 +3,135 @@ import { Category, PoolType } from './pools'; import { atom } from 'jotai'; import { PoolInfo, ProtocolAtoms } from './pools'; import { Jediswap } from './jedi.store'; +import { Contract, RpcProvider } from 'starknet'; +import vesuAbi from './vesu.abi.json'; +import vesuInterestRateAbi from './vesuInterestRate.abi.json'; -// The Vesu Pool data is hartdcoded here as there is no api and there's a lot of calculations made into finding the apy values for each of thier pool. these values gotten are put into the data array below. +// Initialize the provider +const provider = new RpcProvider({ nodeUrl: process.env.NEXT_PUBLIC_RPC_URL }); +// Define the ABIs for the contracts +const VesuAbi = vesuAbi; +const VesuInterestRateAbi = vesuInterestRateAbi; + +// Utility function to convert a string to BigInt and then to hex +const toBigIntHex = (id: string): string => { + const bigIntValue = BigInt(id); + return `0x${bigIntValue.toString(16)}`; +}; + +// Function to get Utilization +const getUtilisation = async (poolId: string, tokenAddress: string) => { + const contract = new Contract( + VesuAbi, + '0x02545b2e5d519fc230e9cd781046d3a64e092114f07e44771e0d719d148725ef', + provider + ); + const poolidHex = toBigIntHex(poolId); + const res: any = await contract.call('utilization_unsafe', [poolidHex, tokenAddress]); + return res; +}; + +// Function to get Asset Info +const getAssetInfo = async (poolId: string, tokenAddress: string) => { + const contract = new Contract( + VesuAbi, + '0x02545b2e5d519fc230e9cd781046d3a64e092114f07e44771e0d719d148725ef', + provider + ); + + const poolidHex = toBigIntHex(poolId); + const res: any = await contract.call('asset_config_unsafe', [poolidHex, tokenAddress]); + return res[0]; +}; + +// Function to get Base APY +const getBaseApy = async (poolId: string, tokenAddress: string) => { + const contract = new Contract( + VesuInterestRateAbi, + '0x002334189e831d804d4a11d3f71d4a982ec82614ac12ed2e9ca2f8da4e6374fa', + provider + ); + + const poolidHex = toBigIntHex(poolId); + const utilization = await getUtilisation(poolId, tokenAddress); + const assetInfo = await getAssetInfo(poolId, tokenAddress); + const res: any = await contract.call('interest_rate', [ + poolidHex, + tokenAddress, + utilization, + assetInfo.last_updated, + assetInfo.last_full_utilization_rate, + ]); + const interestRate = res[0]; + const apy = + (Number(utilization) / 10 ** 18) * + ((1 + Number(interestRate) / 10 ** 18) ** (360 * 86400) - 1); + console.log(apy); + return apy; +}; + +// The Vesu Pool data is hardcoded here as there is no API and there's a lot of calculations made into finding the APY values for each of their pools. const poolsData = [ { id: 'ETH', isVesu: true, tokenA: 'ETH', - baseApr: '0.0000305', + poolId: '2198503327643286920898110335698706244522220458610657370981979460625005526824', + tokenAddress: '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7', rewardApr: '0.09', + baseApr: '0', tvl: '1000000', }, { id: 'STRK', isVesu: true, tokenA: 'STRK', - baseApr: '0.0000074', + poolId: '2198503327643286920898110335698706244522220458610657370981979460625005526824', + tokenAddress: '0x4718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d', rewardApr: '0.13', + baseApr: '0', tvl: '2000000', }, { id: 'USDC', isVesu: true, tokenA: 'USDC', - baseApr: '0.000245', + poolId: '2198503327643286920898110335698706244522220458610657370981979460625005526824', + tokenAddress: '0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8', rewardApr: '0.10', + baseApr: '0', tvl: '2000000', }, { id: 'USDT', isVesu: true, tokenA: 'USDT', - baseApr: '0.000917', + poolId: '2198503327643286920898110335698706244522220458610657370981979460625005526824', + tokenAddress: '0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8', rewardApr: '0.10', + baseApr: '0', tvl: '2000000', }, ]; +// Fetch and update pools data with base APR values +async function fetchAndUpdatePoolsData() { + for (const pool of poolsData) { + const res = await getBaseApy(pool.poolId, pool.tokenAddress); + pool.baseApr = res.toString(); + console.log(`pool base apr ${ pool.baseApr}`); + } +} + +(async function fetchAndInitializePoolsData() { + const res = await fetchAndUpdatePoolsData(); + console.log(res); + return res; +}()).catch((err) => { + console.error("Error fetching and updating pools data:", err); +}); + export class Vesu extends Jediswap { name = 'Vesu.xyz'; link = 'https://www.vesu.xyz/markets'; @@ -51,15 +142,16 @@ export class Vesu extends Jediswap { _computePoolsInfo() { try { const pools: PoolInfo[] = []; - poolsData - .filter((poolData) => poolData.isVesu) - .forEach((poolData) => { + poolsData.forEach((poolData) => { + if (poolData.isVesu) { const category = Category.Stable; const tokens: TokenName[] = [poolData.tokenA] as TokenName[]; const logo1 = CONSTANTS.LOGOS[tokens[0]]; - const baseApr = - poolData.baseApr === '0' ? 0.0 : parseFloat(poolData.baseApr); + + // Use the precomputed baseApr + const baseApr = parseFloat(poolData.baseApr); const rewardApr = parseFloat(poolData.rewardApr); + const poolInfo: PoolInfo = { pool: { name: poolData.id, @@ -95,7 +187,9 @@ export class Vesu extends Jediswap { }, }; pools.push(poolInfo); - }); + } + }); + console.log(pools); return pools; } catch (err) { console.error('Err computing pools', err); @@ -112,4 +206,4 @@ const VesuAtoms: ProtocolAtoms = { }), }; -export default VesuAtoms; +export default VesuAtoms; \ No newline at end of file diff --git a/src/store/vesuInterestRate.abi.json b/src/store/vesuInterestRate.abi.json new file mode 100644 index 00000000..b781b006 --- /dev/null +++ b/src/store/vesuInterestRate.abi.json @@ -0,0 +1,1946 @@ +[ + { + "name": "DefaultExtensionImpl", + "type": "impl", + "interface_name": "vesu::extension::default_extension::IDefaultExtension" + }, + { + "name": "vesu::extension::components::pragma_oracle::OracleConfig", + "type": "struct", + "members": [ + { + "name": "pragma_key", + "type": "core::felt252" + }, + { + "name": "timeout", + "type": "core::integer::u64" + }, + { + "name": "number_of_sources", + "type": "core::integer::u32" + } + ] + }, + { + "name": "vesu::extension::components::fee_model::FeeConfig", + "type": "struct", + "members": [ + { + "name": "fee_recipient", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "name": "core::integer::u256", + "type": "struct", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "name": "vesu::extension::components::interest_rate_model::InterestRateConfig", + "type": "struct", + "members": [ + { + "name": "min_target_utilization", + "type": "core::integer::u256" + }, + { + "name": "max_target_utilization", + "type": "core::integer::u256" + }, + { + "name": "target_utilization", + "type": "core::integer::u256" + }, + { + "name": "min_full_utilization_rate", + "type": "core::integer::u256" + }, + { + "name": "max_full_utilization_rate", + "type": "core::integer::u256" + }, + { + "name": "zero_utilization_rate", + "type": "core::integer::u256" + }, + { + "name": "rate_half_life", + "type": "core::integer::u256" + }, + { + "name": "target_rate_percent", + "type": "core::integer::u256" + } + ] + }, + { + "name": "vesu::extension::components::position_hooks::LiquidationConfig", + "type": "struct", + "members": [ + { + "name": "liquidation_factor", + "type": "core::integer::u64" + } + ] + }, + { + "name": "vesu::extension::components::position_hooks::ShutdownConfig", + "type": "struct", + "members": [ + { + "name": "recovery_period", + "type": "core::integer::u64" + }, + { + "name": "subscription_period", + "type": "core::integer::u64" + } + ] + }, + { + "name": "vesu::data_model::LTVConfig", + "type": "struct", + "members": [ + { + "name": "max_ltv", + "type": "core::integer::u64" + } + ] + }, + { + "name": "vesu::extension::components::position_hooks::ShutdownMode", + "type": "enum", + "variants": [ + { + "name": "None", + "type": "()" + }, + { + "name": "Recovery", + "type": "()" + }, + { + "name": "Subscription", + "type": "()" + }, + { + "name": "Redemption", + "type": "()" + } + ] + }, + { + "name": "core::bool", + "type": "enum", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "name": "vesu::extension::components::position_hooks::ShutdownStatus", + "type": "struct", + "members": [ + { + "name": "shutdown_mode", + "type": "vesu::extension::components::position_hooks::ShutdownMode" + }, + { + "name": "violating", + "type": "core::bool" + }, + { + "name": "previous_violation_timestamp", + "type": "core::integer::u64" + }, + { + "name": "count_at_violation_timestamp", + "type": "core::integer::u128" + } + ] + }, + { + "name": "vesu::extension::components::position_hooks::Pair", + "type": "struct", + "members": [ + { + "name": "total_collateral_shares", + "type": "core::integer::u256" + }, + { + "name": "total_nominal_debt", + "type": "core::integer::u256" + } + ] + }, + { + "name": "vesu::data_model::AssetParams", + "type": "struct", + "members": [ + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "floor", + "type": "core::integer::u256" + }, + { + "name": "initial_rate_accumulator", + "type": "core::integer::u256" + }, + { + "name": "initial_full_utilization_rate", + "type": "core::integer::u256" + }, + { + "name": "max_utilization", + "type": "core::integer::u256" + }, + { + "name": "is_legacy", + "type": "core::bool" + }, + { + "name": "fee_rate", + "type": "core::integer::u256" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "vesu::extension::default_extension::VTokenParams", + "type": "struct", + "members": [ + { + "name": "v_token_name", + "type": "core::felt252" + }, + { + "name": "v_token_symbol", + "type": "core::felt252" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "vesu::data_model::LTVParams", + "type": "struct", + "members": [ + { + "name": "collateral_asset_index", + "type": "core::integer::u32" + }, + { + "name": "debt_asset_index", + "type": "core::integer::u32" + }, + { + "name": "max_ltv", + "type": "core::integer::u64" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "vesu::extension::default_extension::PragmaOracleParams", + "type": "struct", + "members": [ + { + "name": "pragma_key", + "type": "core::felt252" + }, + { + "name": "timeout", + "type": "core::integer::u64" + }, + { + "name": "number_of_sources", + "type": "core::integer::u32" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "vesu::extension::default_extension::LiquidationParams", + "type": "struct", + "members": [ + { + "name": "collateral_asset_index", + "type": "core::integer::u32" + }, + { + "name": "debt_asset_index", + "type": "core::integer::u32" + }, + { + "name": "liquidation_factor", + "type": "core::integer::u64" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "vesu::extension::default_extension::ShutdownParams", + "type": "struct", + "members": [ + { + "name": "recovery_period", + "type": "core::integer::u64" + }, + { + "name": "subscription_period", + "type": "core::integer::u64" + }, + { + "name": "ltv_params", + "type": "core::array::Span::" + } + ] + }, + { + "name": "vesu::extension::default_extension::FeeParams", + "type": "struct", + "members": [ + { + "name": "fee_recipient", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "name": "vesu::extension::default_extension::IDefaultExtension", + "type": "interface", + "items": [ + { + "name": "pool_owner", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "name": "pragma_oracle", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "name": "oracle_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::extension::components::pragma_oracle::OracleConfig" + } + ], + "state_mutability": "view" + }, + { + "name": "fee_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "vesu::extension::components::fee_model::FeeConfig" + } + ], + "state_mutability": "view" + }, + { + "name": "interest_rate_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::extension::components::interest_rate_model::InterestRateConfig" + } + ], + "state_mutability": "view" + }, + { + "name": "liquidation_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::extension::components::position_hooks::LiquidationConfig" + } + ], + "state_mutability": "view" + }, + { + "name": "shutdown_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "vesu::extension::components::position_hooks::ShutdownConfig" + } + ], + "state_mutability": "view" + }, + { + "name": "shutdown_ltv_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::data_model::LTVConfig" + } + ], + "state_mutability": "view" + }, + { + "name": "shutdown_status", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::extension::components::position_hooks::ShutdownStatus" + } + ], + "state_mutability": "view" + }, + { + "name": "pairs", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::extension::components::position_hooks::Pair" + } + ], + "state_mutability": "view" + }, + { + "name": "violation_timestamp_for_pair", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "name": "violation_timestamp_count", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "violation_timestamp", + "type": "core::integer::u64" + } + ], + "outputs": [ + { + "type": "core::integer::u128" + } + ], + "state_mutability": "view" + }, + { + "name": "oldest_violation_timestamp", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "name": "next_violation_timestamp", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "violation_timestamp", + "type": "core::integer::u64" + } + ], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "name": "v_token_for_collateral_asset", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "name": "collateral_asset_for_v_token", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "v_token", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "name": "create_pool", + "type": "function", + "inputs": [ + { + "name": "asset_params", + "type": "core::array::Span::" + }, + { + "name": "v_token_params", + "type": "core::array::Span::" + }, + { + "name": "ltv_params", + "type": "core::array::Span::" + }, + { + "name": "interest_rate_configs", + "type": "core::array::Span::" + }, + { + "name": "pragma_oracle_params", + "type": "core::array::Span::" + }, + { + "name": "liquidation_params", + "type": "core::array::Span::" + }, + { + "name": "shutdown_params", + "type": "vesu::extension::default_extension::ShutdownParams" + }, + { + "name": "fee_params", + "type": "vesu::extension::default_extension::FeeParams" + }, + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "name": "add_asset", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset_params", + "type": "vesu::data_model::AssetParams" + }, + { + "name": "v_token_params", + "type": "vesu::extension::default_extension::VTokenParams" + }, + { + "name": "interest_rate_config", + "type": "vesu::extension::components::interest_rate_model::InterestRateConfig" + }, + { + "name": "pragma_oracle_params", + "type": "vesu::extension::default_extension::PragmaOracleParams" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_asset_parameter", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "parameter", + "type": "core::felt252" + }, + { + "name": "value", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_interest_rate_parameter", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "parameter", + "type": "core::felt252" + }, + { + "name": "value", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_oracle_parameter", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "parameter", + "type": "core::felt252" + }, + { + "name": "value", + "type": "core::integer::u64" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_liquidation_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "liquidation_config", + "type": "vesu::extension::components::position_hooks::LiquidationConfig" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_ltv_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "ltv_config", + "type": "vesu::data_model::LTVConfig" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_shutdown_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "shutdown_config", + "type": "vesu::extension::components::position_hooks::ShutdownConfig" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_shutdown_ltv_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "shutdown_ltv_config", + "type": "vesu::data_model::LTVConfig" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_extension", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "extension", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_pool_owner", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "update_shutdown_status", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::extension::components::position_hooks::ShutdownMode" + } + ], + "state_mutability": "external" + }, + { + "name": "claim_fees", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "ExtensionImpl", + "type": "impl", + "interface_name": "vesu::extension::interface::IExtension" + }, + { + "name": "vesu::data_model::AssetPrice", + "type": "struct", + "members": [ + { + "name": "value", + "type": "core::integer::u256" + }, + { + "name": "is_valid", + "type": "core::bool" + } + ] + }, + { + "name": "vesu::data_model::AssetConfig", + "type": "struct", + "members": [ + { + "name": "total_collateral_shares", + "type": "core::integer::u256" + }, + { + "name": "total_nominal_debt", + "type": "core::integer::u256" + }, + { + "name": "reserve", + "type": "core::integer::u256" + }, + { + "name": "max_utilization", + "type": "core::integer::u256" + }, + { + "name": "floor", + "type": "core::integer::u256" + }, + { + "name": "scale", + "type": "core::integer::u256" + }, + { + "name": "is_legacy", + "type": "core::bool" + }, + { + "name": "last_updated", + "type": "core::integer::u64" + }, + { + "name": "last_rate_accumulator", + "type": "core::integer::u256" + }, + { + "name": "last_full_utilization_rate", + "type": "core::integer::u256" + }, + { + "name": "fee_rate", + "type": "core::integer::u256" + } + ] + }, + { + "name": "vesu::data_model::Position", + "type": "struct", + "members": [ + { + "name": "collateral_shares", + "type": "core::integer::u256" + }, + { + "name": "nominal_debt", + "type": "core::integer::u256" + } + ] + }, + { + "name": "vesu::data_model::Context", + "type": "struct", + "members": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "extension", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral_asset_config", + "type": "vesu::data_model::AssetConfig" + }, + { + "name": "debt_asset_config", + "type": "vesu::data_model::AssetConfig" + }, + { + "name": "collateral_asset_price", + "type": "vesu::data_model::AssetPrice" + }, + { + "name": "debt_asset_price", + "type": "vesu::data_model::AssetPrice" + }, + { + "name": "collateral_asset_fee_shares", + "type": "core::integer::u256" + }, + { + "name": "debt_asset_fee_shares", + "type": "core::integer::u256" + }, + { + "name": "max_ltv", + "type": "core::integer::u64" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "position", + "type": "vesu::data_model::Position" + } + ] + }, + { + "name": "vesu::data_model::AmountType", + "type": "enum", + "variants": [ + { + "name": "Delta", + "type": "()" + }, + { + "name": "Target", + "type": "()" + } + ] + }, + { + "name": "vesu::data_model::AmountDenomination", + "type": "enum", + "variants": [ + { + "name": "Native", + "type": "()" + }, + { + "name": "Assets", + "type": "()" + } + ] + }, + { + "name": "alexandria_math::i257::i257", + "type": "struct", + "members": [ + { + "name": "abs", + "type": "core::integer::u256" + }, + { + "name": "is_negative", + "type": "core::bool" + } + ] + }, + { + "name": "vesu::data_model::Amount", + "type": "struct", + "members": [ + { + "name": "amount_type", + "type": "vesu::data_model::AmountType" + }, + { + "name": "denomination", + "type": "vesu::data_model::AmountDenomination" + }, + { + "name": "value", + "type": "alexandria_math::i257::i257" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "vesu::data_model::UnsignedAmount", + "type": "struct", + "members": [ + { + "name": "amount_type", + "type": "vesu::data_model::AmountType" + }, + { + "name": "denomination", + "type": "vesu::data_model::AmountDenomination" + }, + { + "name": "value", + "type": "core::integer::u256" + } + ] + }, + { + "name": "vesu::extension::interface::IExtension", + "type": "interface", + "items": [ + { + "name": "singleton", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "name": "price", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::data_model::AssetPrice" + } + ], + "state_mutability": "view" + }, + { + "name": "interest_rate", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "utilization", + "type": "core::integer::u256" + }, + { + "name": "last_updated", + "type": "core::integer::u64" + }, + { + "name": "last_full_utilization_rate", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "rate_accumulator", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "utilization", + "type": "core::integer::u256" + }, + { + "name": "last_updated", + "type": "core::integer::u64" + }, + { + "name": "last_rate_accumulator", + "type": "core::integer::u256" + }, + { + "name": "last_full_utilization_rate", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "(core::integer::u256, core::integer::u256)" + } + ], + "state_mutability": "view" + }, + { + "name": "before_modify_position", + "type": "function", + "inputs": [ + { + "name": "context", + "type": "vesu::data_model::Context" + }, + { + "name": "collateral", + "type": "vesu::data_model::Amount" + }, + { + "name": "debt", + "type": "vesu::data_model::Amount" + }, + { + "name": "data", + "type": "core::array::Span::" + }, + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(vesu::data_model::Amount, vesu::data_model::Amount)" + } + ], + "state_mutability": "external" + }, + { + "name": "after_modify_position", + "type": "function", + "inputs": [ + { + "name": "context", + "type": "vesu::data_model::Context" + }, + { + "name": "collateral_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "collateral_shares_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "nominal_debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "data", + "type": "core::array::Span::" + }, + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "name": "before_transfer_position", + "type": "function", + "inputs": [ + { + "name": "from_context", + "type": "vesu::data_model::Context" + }, + { + "name": "to_context", + "type": "vesu::data_model::Context" + }, + { + "name": "collateral", + "type": "vesu::data_model::UnsignedAmount" + }, + { + "name": "debt", + "type": "vesu::data_model::UnsignedAmount" + }, + { + "name": "data", + "type": "core::array::Span::" + }, + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(vesu::data_model::UnsignedAmount, vesu::data_model::UnsignedAmount)" + } + ], + "state_mutability": "external" + }, + { + "name": "after_transfer_position", + "type": "function", + "inputs": [ + { + "name": "from_context", + "type": "vesu::data_model::Context" + }, + { + "name": "to_context", + "type": "vesu::data_model::Context" + }, + { + "name": "collateral_delta", + "type": "core::integer::u256" + }, + { + "name": "collateral_shares_delta", + "type": "core::integer::u256" + }, + { + "name": "debt_delta", + "type": "core::integer::u256" + }, + { + "name": "nominal_debt_delta", + "type": "core::integer::u256" + }, + { + "name": "data", + "type": "core::array::Span::" + }, + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "name": "before_liquidate_position", + "type": "function", + "inputs": [ + { + "name": "context", + "type": "vesu::data_model::Context" + }, + { + "name": "data", + "type": "core::array::Span::" + }, + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(core::integer::u256, core::integer::u256, core::integer::u256)" + } + ], + "state_mutability": "external" + }, + { + "name": "after_liquidate_position", + "type": "function", + "inputs": [ + { + "name": "context", + "type": "vesu::data_model::Context" + }, + { + "name": "collateral_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "collateral_shares_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "nominal_debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "bad_debt", + "type": "core::integer::u256" + }, + { + "name": "data", + "type": "core::array::Span::" + }, + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + } + ] + }, + { + "name": "constructor", + "type": "constructor", + "inputs": [ + { + "name": "singleton", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "oracle_address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "v_token_class_hash", + "type": "core::felt252" + } + ] + }, + { + "kind": "struct", + "name": "vesu::extension::components::position_hooks::position_hooks_component::SetLiquidationConfig", + "type": "event", + "members": [ + { + "kind": "data", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "liquidation_config", + "type": "vesu::extension::components::position_hooks::LiquidationConfig" + } + ] + }, + { + "kind": "struct", + "name": "vesu::extension::components::position_hooks::position_hooks_component::SetShutdownConfig", + "type": "event", + "members": [ + { + "kind": "data", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "shutdown_config", + "type": "vesu::extension::components::position_hooks::ShutdownConfig" + } + ] + }, + { + "kind": "struct", + "name": "vesu::extension::components::position_hooks::position_hooks_component::SetShutdownLTVConfig", + "type": "event", + "members": [ + { + "kind": "data", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "shutdown_ltv_config", + "type": "vesu::data_model::LTVConfig" + } + ] + }, + { + "kind": "enum", + "name": "vesu::extension::components::position_hooks::position_hooks_component::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "SetLiquidationConfig", + "type": "vesu::extension::components::position_hooks::position_hooks_component::SetLiquidationConfig" + }, + { + "kind": "nested", + "name": "SetShutdownConfig", + "type": "vesu::extension::components::position_hooks::position_hooks_component::SetShutdownConfig" + }, + { + "kind": "nested", + "name": "SetShutdownLTVConfig", + "type": "vesu::extension::components::position_hooks::position_hooks_component::SetShutdownLTVConfig" + } + ] + }, + { + "kind": "struct", + "name": "vesu::extension::components::interest_rate_model::interest_rate_model_component::SetInterestRateConfig", + "type": "event", + "members": [ + { + "kind": "data", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "interest_rate_config", + "type": "vesu::extension::components::interest_rate_model::InterestRateConfig" + } + ] + }, + { + "kind": "enum", + "name": "vesu::extension::components::interest_rate_model::interest_rate_model_component::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "SetInterestRateConfig", + "type": "vesu::extension::components::interest_rate_model::interest_rate_model_component::SetInterestRateConfig" + } + ] + }, + { + "kind": "struct", + "name": "vesu::extension::components::pragma_oracle::pragma_oracle_component::SetOracleConfig", + "type": "event", + "members": [ + { + "kind": "data", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "oracle_config", + "type": "vesu::extension::components::pragma_oracle::OracleConfig" + } + ] + }, + { + "kind": "struct", + "name": "vesu::extension::components::pragma_oracle::pragma_oracle_component::SetOracleParameter", + "type": "event", + "members": [ + { + "kind": "data", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "parameter", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "value", + "type": "core::integer::u64" + } + ] + }, + { + "kind": "enum", + "name": "vesu::extension::components::pragma_oracle::pragma_oracle_component::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "SetOracleConfig", + "type": "vesu::extension::components::pragma_oracle::pragma_oracle_component::SetOracleConfig" + }, + { + "kind": "nested", + "name": "SetOracleParameter", + "type": "vesu::extension::components::pragma_oracle::pragma_oracle_component::SetOracleParameter" + } + ] + }, + { + "kind": "enum", + "name": "vesu::map_list::map_list_component::Event", + "type": "event", + "variants": [] + }, + { + "kind": "struct", + "name": "vesu::extension::components::fee_model::fee_model_component::SetFeeConfig", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "fee_config", + "type": "vesu::extension::components::fee_model::FeeConfig" + } + ] + }, + { + "kind": "struct", + "name": "vesu::extension::components::fee_model::fee_model_component::ClaimFees", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "amount", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "enum", + "name": "vesu::extension::components::fee_model::fee_model_component::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "SetFeeConfig", + "type": "vesu::extension::components::fee_model::fee_model_component::SetFeeConfig" + }, + { + "kind": "nested", + "name": "ClaimFees", + "type": "vesu::extension::components::fee_model::fee_model_component::ClaimFees" + } + ] + }, + { + "kind": "enum", + "name": "vesu::extension::components::tokenization::tokenization_component::Event", + "type": "event", + "variants": [] + }, + { + "kind": "struct", + "name": "vesu::extension::default_extension::DefaultExtension::SetAssetParameter", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "parameter", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "value", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "struct", + "name": "vesu::extension::default_extension::DefaultExtension::SetPoolOwner", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "enum", + "name": "vesu::extension::default_extension::DefaultExtension::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "PositionHooksEvents", + "type": "vesu::extension::components::position_hooks::position_hooks_component::Event" + }, + { + "kind": "nested", + "name": "InterestRateModelEvents", + "type": "vesu::extension::components::interest_rate_model::interest_rate_model_component::Event" + }, + { + "kind": "nested", + "name": "PragmaOracleEvents", + "type": "vesu::extension::components::pragma_oracle::pragma_oracle_component::Event" + }, + { + "kind": "nested", + "name": "MapListEvents", + "type": "vesu::map_list::map_list_component::Event" + }, + { + "kind": "nested", + "name": "FeeModelEvents", + "type": "vesu::extension::components::fee_model::fee_model_component::Event" + }, + { + "kind": "nested", + "name": "TokenizationEvents", + "type": "vesu::extension::components::tokenization::tokenization_component::Event" + }, + { + "kind": "nested", + "name": "SetAssetParameter", + "type": "vesu::extension::default_extension::DefaultExtension::SetAssetParameter" + }, + { + "kind": "nested", + "name": "SetPoolOwner", + "type": "vesu::extension::default_extension::DefaultExtension::SetPoolOwner" + } + ] + } +] \ No newline at end of file From 09d1f95a08ef37f62982a2dd38e06dad806fc1cf Mon Sep 17 00:00:00 2001 From: Ugo-X Date: Wed, 28 Aug 2024 18:05:18 +0100 Subject: [PATCH 3/6] updated PR --- src/abi/vesu.abi.json | 1903 ++++++++++++++++++++++++++ src/abi/vesuInterestRate.abi.json | 1946 +++++++++++++++++++++++++++ src/store/vesu.abi.json | 1903 -------------------------- src/store/vesu.store.ts | 73 +- src/store/vesuInterestRate.abi.json | 1946 --------------------------- 5 files changed, 3890 insertions(+), 3881 deletions(-) create mode 100644 src/abi/vesu.abi.json create mode 100644 src/abi/vesuInterestRate.abi.json delete mode 100644 src/store/vesu.abi.json delete mode 100644 src/store/vesuInterestRate.abi.json diff --git a/src/abi/vesu.abi.json b/src/abi/vesu.abi.json new file mode 100644 index 00000000..50f07890 --- /dev/null +++ b/src/abi/vesu.abi.json @@ -0,0 +1,1903 @@ +[ + { + "name": "SingletonImpl", + "type": "impl", + "interface_name": "vesu::singleton::ISingleton" + }, + { + "name": "core::integer::u256", + "type": "struct", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "name": "core::bool", + "type": "enum", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "name": "vesu::data_model::AssetConfig", + "type": "struct", + "members": [ + { + "name": "total_collateral_shares", + "type": "core::integer::u256" + }, + { + "name": "total_nominal_debt", + "type": "core::integer::u256" + }, + { + "name": "reserve", + "type": "core::integer::u256" + }, + { + "name": "max_utilization", + "type": "core::integer::u256" + }, + { + "name": "floor", + "type": "core::integer::u256" + }, + { + "name": "scale", + "type": "core::integer::u256" + }, + { + "name": "is_legacy", + "type": "core::bool" + }, + { + "name": "last_updated", + "type": "core::integer::u64" + }, + { + "name": "last_rate_accumulator", + "type": "core::integer::u256" + }, + { + "name": "last_full_utilization_rate", + "type": "core::integer::u256" + }, + { + "name": "fee_rate", + "type": "core::integer::u256" + } + ] + }, + { + "name": "vesu::data_model::LTVConfig", + "type": "struct", + "members": [ + { + "name": "max_ltv", + "type": "core::integer::u64" + } + ] + }, + { + "name": "vesu::data_model::Position", + "type": "struct", + "members": [ + { + "name": "collateral_shares", + "type": "core::integer::u256" + }, + { + "name": "nominal_debt", + "type": "core::integer::u256" + } + ] + }, + { + "name": "alexandria_math::i257::i257", + "type": "struct", + "members": [ + { + "name": "abs", + "type": "core::integer::u256" + }, + { + "name": "is_negative", + "type": "core::bool" + } + ] + }, + { + "name": "vesu::data_model::AmountType", + "type": "enum", + "variants": [ + { + "name": "Delta", + "type": "()" + }, + { + "name": "Target", + "type": "()" + } + ] + }, + { + "name": "vesu::data_model::AmountDenomination", + "type": "enum", + "variants": [ + { + "name": "Native", + "type": "()" + }, + { + "name": "Assets", + "type": "()" + } + ] + }, + { + "name": "vesu::data_model::Amount", + "type": "struct", + "members": [ + { + "name": "amount_type", + "type": "vesu::data_model::AmountType" + }, + { + "name": "denomination", + "type": "vesu::data_model::AmountDenomination" + }, + { + "name": "value", + "type": "alexandria_math::i257::i257" + } + ] + }, + { + "name": "vesu::data_model::AssetPrice", + "type": "struct", + "members": [ + { + "name": "value", + "type": "core::integer::u256" + }, + { + "name": "is_valid", + "type": "core::bool" + } + ] + }, + { + "name": "vesu::data_model::Context", + "type": "struct", + "members": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "extension", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral_asset_config", + "type": "vesu::data_model::AssetConfig" + }, + { + "name": "debt_asset_config", + "type": "vesu::data_model::AssetConfig" + }, + { + "name": "collateral_asset_price", + "type": "vesu::data_model::AssetPrice" + }, + { + "name": "debt_asset_price", + "type": "vesu::data_model::AssetPrice" + }, + { + "name": "collateral_asset_fee_shares", + "type": "core::integer::u256" + }, + { + "name": "debt_asset_fee_shares", + "type": "core::integer::u256" + }, + { + "name": "max_ltv", + "type": "core::integer::u64" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "position", + "type": "vesu::data_model::Position" + } + ] + }, + { + "name": "vesu::data_model::AssetParams", + "type": "struct", + "members": [ + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "floor", + "type": "core::integer::u256" + }, + { + "name": "initial_rate_accumulator", + "type": "core::integer::u256" + }, + { + "name": "initial_full_utilization_rate", + "type": "core::integer::u256" + }, + { + "name": "max_utilization", + "type": "core::integer::u256" + }, + { + "name": "is_legacy", + "type": "core::bool" + }, + { + "name": "fee_rate", + "type": "core::integer::u256" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "vesu::data_model::LTVParams", + "type": "struct", + "members": [ + { + "name": "collateral_asset_index", + "type": "core::integer::u32" + }, + { + "name": "debt_asset_index", + "type": "core::integer::u32" + }, + { + "name": "max_ltv", + "type": "core::integer::u64" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "vesu::data_model::ModifyPositionParams", + "type": "struct", + "members": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral", + "type": "vesu::data_model::Amount" + }, + { + "name": "debt", + "type": "vesu::data_model::Amount" + }, + { + "name": "data", + "type": "core::array::Span::" + } + ] + }, + { + "name": "vesu::data_model::UpdatePositionResponse", + "type": "struct", + "members": [ + { + "name": "collateral_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "collateral_shares_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "nominal_debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "bad_debt", + "type": "core::integer::u256" + } + ] + }, + { + "name": "vesu::data_model::UnsignedAmount", + "type": "struct", + "members": [ + { + "name": "amount_type", + "type": "vesu::data_model::AmountType" + }, + { + "name": "denomination", + "type": "vesu::data_model::AmountDenomination" + }, + { + "name": "value", + "type": "core::integer::u256" + } + ] + }, + { + "name": "vesu::data_model::TransferPositionParams", + "type": "struct", + "members": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "from_collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "from_debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "to_collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "to_debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "from_user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "to_user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral", + "type": "vesu::data_model::UnsignedAmount" + }, + { + "name": "debt", + "type": "vesu::data_model::UnsignedAmount" + }, + { + "name": "from_data", + "type": "core::array::Span::" + }, + { + "name": "to_data", + "type": "core::array::Span::" + } + ] + }, + { + "name": "vesu::data_model::LiquidatePositionParams", + "type": "struct", + "members": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "receive_as_shares", + "type": "core::bool" + }, + { + "name": "data", + "type": "core::array::Span::" + } + ] + }, + { + "name": "vesu::singleton::ISingleton", + "type": "interface", + "items": [ + { + "name": "creator_nonce", + "type": "function", + "inputs": [ + { + "name": "creator", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "extension", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "name": "asset_config_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(vesu::data_model::AssetConfig, core::integer::u256)" + } + ], + "state_mutability": "view" + }, + { + "name": "asset_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(vesu::data_model::AssetConfig, core::integer::u256)" + } + ], + "state_mutability": "external" + }, + { + "name": "ltv_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::data_model::LTVConfig" + } + ], + "state_mutability": "view" + }, + { + "name": "position_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(vesu::data_model::Position, core::integer::u256, core::integer::u256)" + } + ], + "state_mutability": "view" + }, + { + "name": "position", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(vesu::data_model::Position, core::integer::u256, core::integer::u256)" + } + ], + "state_mutability": "external" + }, + { + "name": "check_collateralization_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(core::bool, core::integer::u256, core::integer::u256)" + } + ], + "state_mutability": "view" + }, + { + "name": "check_collateralization", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(core::bool, core::integer::u256, core::integer::u256)" + } + ], + "state_mutability": "external" + }, + { + "name": "rate_accumulator_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "rate_accumulator", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "external" + }, + { + "name": "utilization_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "utilization", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "external" + }, + { + "name": "delegation", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "delegator", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "delegatee", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "name": "calculate_pool_id", + "type": "function", + "inputs": [ + { + "name": "caller_address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "nonce", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "view" + }, + { + "name": "calculate_debt", + "type": "function", + "inputs": [ + { + "name": "nominal_debt", + "type": "alexandria_math::i257::i257" + }, + { + "name": "rate_accumulator", + "type": "core::integer::u256" + }, + { + "name": "asset_scale", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "calculate_nominal_debt", + "type": "function", + "inputs": [ + { + "name": "debt", + "type": "alexandria_math::i257::i257" + }, + { + "name": "rate_accumulator", + "type": "core::integer::u256" + }, + { + "name": "asset_scale", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "calculate_collateral_shares_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral", + "type": "alexandria_math::i257::i257" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "calculate_collateral_shares", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral", + "type": "alexandria_math::i257::i257" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "external" + }, + { + "name": "calculate_collateral_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral_shares", + "type": "alexandria_math::i257::i257" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "calculate_collateral", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral_shares", + "type": "alexandria_math::i257::i257" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "external" + }, + { + "name": "deconstruct_collateral_amount_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral", + "type": "vesu::data_model::Amount" + } + ], + "outputs": [ + { + "type": "(alexandria_math::i257::i257, alexandria_math::i257::i257)" + } + ], + "state_mutability": "view" + }, + { + "name": "deconstruct_collateral_amount", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral", + "type": "vesu::data_model::Amount" + } + ], + "outputs": [ + { + "type": "(alexandria_math::i257::i257, alexandria_math::i257::i257)" + } + ], + "state_mutability": "external" + }, + { + "name": "deconstruct_debt_amount_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt", + "type": "vesu::data_model::Amount" + } + ], + "outputs": [ + { + "type": "(alexandria_math::i257::i257, alexandria_math::i257::i257)" + } + ], + "state_mutability": "view" + }, + { + "name": "deconstruct_debt_amount", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt", + "type": "vesu::data_model::Amount" + } + ], + "outputs": [ + { + "type": "(alexandria_math::i257::i257, alexandria_math::i257::i257)" + } + ], + "state_mutability": "external" + }, + { + "name": "context_unsafe", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::data_model::Context" + } + ], + "state_mutability": "view" + }, + { + "name": "context", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::data_model::Context" + } + ], + "state_mutability": "external" + }, + { + "name": "create_pool", + "type": "function", + "inputs": [ + { + "name": "asset_params", + "type": "core::array::Span::" + }, + { + "name": "ltv_params", + "type": "core::array::Span::" + }, + { + "name": "extension", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "name": "modify_position", + "type": "function", + "inputs": [ + { + "name": "params", + "type": "vesu::data_model::ModifyPositionParams" + } + ], + "outputs": [ + { + "type": "vesu::data_model::UpdatePositionResponse" + } + ], + "state_mutability": "external" + }, + { + "name": "transfer_position", + "type": "function", + "inputs": [ + { + "name": "params", + "type": "vesu::data_model::TransferPositionParams" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "liquidate_position", + "type": "function", + "inputs": [ + { + "name": "params", + "type": "vesu::data_model::LiquidatePositionParams" + } + ], + "outputs": [ + { + "type": "vesu::data_model::UpdatePositionResponse" + } + ], + "state_mutability": "external" + }, + { + "name": "flash_loan", + "type": "function", + "inputs": [ + { + "name": "receiver", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + }, + { + "name": "is_legacy", + "type": "core::bool" + }, + { + "name": "data", + "type": "core::array::Span::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "modify_delegation", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "delegatee", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "delegation", + "type": "core::bool" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "donate_to_reserve", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "retrieve_from_reserve", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "receiver", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "amount", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_asset_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "params", + "type": "vesu::data_model::AssetParams" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_ltv_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "ltv_config", + "type": "vesu::data_model::LTVConfig" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_asset_parameter", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "parameter", + "type": "core::felt252" + }, + { + "name": "value", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_extension", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "extension", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "claim_fee_shares", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::CreatePool", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "extension", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "creator", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::ModifyPosition", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "collateral_delta", + "type": "alexandria_math::i257::i257" + }, + { + "kind": "data", + "name": "collateral_shares_delta", + "type": "alexandria_math::i257::i257" + }, + { + "kind": "data", + "name": "debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "kind": "data", + "name": "nominal_debt_delta", + "type": "alexandria_math::i257::i257" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::TransferPosition", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "from_collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "from_debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "to_collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "to_debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "from_user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "to_user", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::LiquidatePosition", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "liquidator", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "collateral_delta", + "type": "alexandria_math::i257::i257" + }, + { + "kind": "data", + "name": "collateral_shares_delta", + "type": "alexandria_math::i257::i257" + }, + { + "kind": "data", + "name": "debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "kind": "data", + "name": "nominal_debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "kind": "data", + "name": "bad_debt", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::AccrueFees", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "fee_shares", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::UpdateContext", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "collateral_asset_config", + "type": "vesu::data_model::AssetConfig" + }, + { + "kind": "data", + "name": "debt_asset_config", + "type": "vesu::data_model::AssetConfig" + }, + { + "kind": "data", + "name": "collateral_asset_price", + "type": "vesu::data_model::AssetPrice" + }, + { + "kind": "data", + "name": "debt_asset_price", + "type": "vesu::data_model::AssetPrice" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::Flashloan", + "type": "event", + "members": [ + { + "kind": "key", + "name": "sender", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "receiver", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "amount", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::ModifyDelegation", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "delegator", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "delegatee", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "delegation", + "type": "core::bool" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::Donate", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "amount", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::RetrieveReserve", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "receiver", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::SetLTVConfig", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "ltv_config", + "type": "vesu::data_model::LTVConfig" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::SetAssetConfig", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::SetAssetParameter", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "parameter", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "value", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "struct", + "name": "vesu::singleton::Singleton::SetExtension", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "extension", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "enum", + "name": "vesu::singleton::Singleton::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "CreatePool", + "type": "vesu::singleton::Singleton::CreatePool" + }, + { + "kind": "nested", + "name": "ModifyPosition", + "type": "vesu::singleton::Singleton::ModifyPosition" + }, + { + "kind": "nested", + "name": "TransferPosition", + "type": "vesu::singleton::Singleton::TransferPosition" + }, + { + "kind": "nested", + "name": "LiquidatePosition", + "type": "vesu::singleton::Singleton::LiquidatePosition" + }, + { + "kind": "nested", + "name": "AccrueFees", + "type": "vesu::singleton::Singleton::AccrueFees" + }, + { + "kind": "nested", + "name": "UpdateContext", + "type": "vesu::singleton::Singleton::UpdateContext" + }, + { + "kind": "nested", + "name": "Flashloan", + "type": "vesu::singleton::Singleton::Flashloan" + }, + { + "kind": "nested", + "name": "ModifyDelegation", + "type": "vesu::singleton::Singleton::ModifyDelegation" + }, + { + "kind": "nested", + "name": "Donate", + "type": "vesu::singleton::Singleton::Donate" + }, + { + "kind": "nested", + "name": "RetrieveReserve", + "type": "vesu::singleton::Singleton::RetrieveReserve" + }, + { + "kind": "nested", + "name": "SetLTVConfig", + "type": "vesu::singleton::Singleton::SetLTVConfig" + }, + { + "kind": "nested", + "name": "SetAssetConfig", + "type": "vesu::singleton::Singleton::SetAssetConfig" + }, + { + "kind": "nested", + "name": "SetAssetParameter", + "type": "vesu::singleton::Singleton::SetAssetParameter" + }, + { + "kind": "nested", + "name": "SetExtension", + "type": "vesu::singleton::Singleton::SetExtension" + } + ] + } +] diff --git a/src/abi/vesuInterestRate.abi.json b/src/abi/vesuInterestRate.abi.json new file mode 100644 index 00000000..b6deeee0 --- /dev/null +++ b/src/abi/vesuInterestRate.abi.json @@ -0,0 +1,1946 @@ +[ + { + "name": "DefaultExtensionImpl", + "type": "impl", + "interface_name": "vesu::extension::default_extension::IDefaultExtension" + }, + { + "name": "vesu::extension::components::pragma_oracle::OracleConfig", + "type": "struct", + "members": [ + { + "name": "pragma_key", + "type": "core::felt252" + }, + { + "name": "timeout", + "type": "core::integer::u64" + }, + { + "name": "number_of_sources", + "type": "core::integer::u32" + } + ] + }, + { + "name": "vesu::extension::components::fee_model::FeeConfig", + "type": "struct", + "members": [ + { + "name": "fee_recipient", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "name": "core::integer::u256", + "type": "struct", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "name": "vesu::extension::components::interest_rate_model::InterestRateConfig", + "type": "struct", + "members": [ + { + "name": "min_target_utilization", + "type": "core::integer::u256" + }, + { + "name": "max_target_utilization", + "type": "core::integer::u256" + }, + { + "name": "target_utilization", + "type": "core::integer::u256" + }, + { + "name": "min_full_utilization_rate", + "type": "core::integer::u256" + }, + { + "name": "max_full_utilization_rate", + "type": "core::integer::u256" + }, + { + "name": "zero_utilization_rate", + "type": "core::integer::u256" + }, + { + "name": "rate_half_life", + "type": "core::integer::u256" + }, + { + "name": "target_rate_percent", + "type": "core::integer::u256" + } + ] + }, + { + "name": "vesu::extension::components::position_hooks::LiquidationConfig", + "type": "struct", + "members": [ + { + "name": "liquidation_factor", + "type": "core::integer::u64" + } + ] + }, + { + "name": "vesu::extension::components::position_hooks::ShutdownConfig", + "type": "struct", + "members": [ + { + "name": "recovery_period", + "type": "core::integer::u64" + }, + { + "name": "subscription_period", + "type": "core::integer::u64" + } + ] + }, + { + "name": "vesu::data_model::LTVConfig", + "type": "struct", + "members": [ + { + "name": "max_ltv", + "type": "core::integer::u64" + } + ] + }, + { + "name": "vesu::extension::components::position_hooks::ShutdownMode", + "type": "enum", + "variants": [ + { + "name": "None", + "type": "()" + }, + { + "name": "Recovery", + "type": "()" + }, + { + "name": "Subscription", + "type": "()" + }, + { + "name": "Redemption", + "type": "()" + } + ] + }, + { + "name": "core::bool", + "type": "enum", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "name": "vesu::extension::components::position_hooks::ShutdownStatus", + "type": "struct", + "members": [ + { + "name": "shutdown_mode", + "type": "vesu::extension::components::position_hooks::ShutdownMode" + }, + { + "name": "violating", + "type": "core::bool" + }, + { + "name": "previous_violation_timestamp", + "type": "core::integer::u64" + }, + { + "name": "count_at_violation_timestamp", + "type": "core::integer::u128" + } + ] + }, + { + "name": "vesu::extension::components::position_hooks::Pair", + "type": "struct", + "members": [ + { + "name": "total_collateral_shares", + "type": "core::integer::u256" + }, + { + "name": "total_nominal_debt", + "type": "core::integer::u256" + } + ] + }, + { + "name": "vesu::data_model::AssetParams", + "type": "struct", + "members": [ + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "floor", + "type": "core::integer::u256" + }, + { + "name": "initial_rate_accumulator", + "type": "core::integer::u256" + }, + { + "name": "initial_full_utilization_rate", + "type": "core::integer::u256" + }, + { + "name": "max_utilization", + "type": "core::integer::u256" + }, + { + "name": "is_legacy", + "type": "core::bool" + }, + { + "name": "fee_rate", + "type": "core::integer::u256" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "vesu::extension::default_extension::VTokenParams", + "type": "struct", + "members": [ + { + "name": "v_token_name", + "type": "core::felt252" + }, + { + "name": "v_token_symbol", + "type": "core::felt252" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "vesu::data_model::LTVParams", + "type": "struct", + "members": [ + { + "name": "collateral_asset_index", + "type": "core::integer::u32" + }, + { + "name": "debt_asset_index", + "type": "core::integer::u32" + }, + { + "name": "max_ltv", + "type": "core::integer::u64" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "vesu::extension::default_extension::PragmaOracleParams", + "type": "struct", + "members": [ + { + "name": "pragma_key", + "type": "core::felt252" + }, + { + "name": "timeout", + "type": "core::integer::u64" + }, + { + "name": "number_of_sources", + "type": "core::integer::u32" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "vesu::extension::default_extension::LiquidationParams", + "type": "struct", + "members": [ + { + "name": "collateral_asset_index", + "type": "core::integer::u32" + }, + { + "name": "debt_asset_index", + "type": "core::integer::u32" + }, + { + "name": "liquidation_factor", + "type": "core::integer::u64" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "vesu::extension::default_extension::ShutdownParams", + "type": "struct", + "members": [ + { + "name": "recovery_period", + "type": "core::integer::u64" + }, + { + "name": "subscription_period", + "type": "core::integer::u64" + }, + { + "name": "ltv_params", + "type": "core::array::Span::" + } + ] + }, + { + "name": "vesu::extension::default_extension::FeeParams", + "type": "struct", + "members": [ + { + "name": "fee_recipient", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "name": "vesu::extension::default_extension::IDefaultExtension", + "type": "interface", + "items": [ + { + "name": "pool_owner", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "name": "pragma_oracle", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "name": "oracle_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::extension::components::pragma_oracle::OracleConfig" + } + ], + "state_mutability": "view" + }, + { + "name": "fee_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "vesu::extension::components::fee_model::FeeConfig" + } + ], + "state_mutability": "view" + }, + { + "name": "interest_rate_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::extension::components::interest_rate_model::InterestRateConfig" + } + ], + "state_mutability": "view" + }, + { + "name": "liquidation_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::extension::components::position_hooks::LiquidationConfig" + } + ], + "state_mutability": "view" + }, + { + "name": "shutdown_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "vesu::extension::components::position_hooks::ShutdownConfig" + } + ], + "state_mutability": "view" + }, + { + "name": "shutdown_ltv_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::data_model::LTVConfig" + } + ], + "state_mutability": "view" + }, + { + "name": "shutdown_status", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::extension::components::position_hooks::ShutdownStatus" + } + ], + "state_mutability": "view" + }, + { + "name": "pairs", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::extension::components::position_hooks::Pair" + } + ], + "state_mutability": "view" + }, + { + "name": "violation_timestamp_for_pair", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "name": "violation_timestamp_count", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "violation_timestamp", + "type": "core::integer::u64" + } + ], + "outputs": [ + { + "type": "core::integer::u128" + } + ], + "state_mutability": "view" + }, + { + "name": "oldest_violation_timestamp", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "name": "next_violation_timestamp", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "violation_timestamp", + "type": "core::integer::u64" + } + ], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "name": "v_token_for_collateral_asset", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "name": "collateral_asset_for_v_token", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "v_token", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "name": "create_pool", + "type": "function", + "inputs": [ + { + "name": "asset_params", + "type": "core::array::Span::" + }, + { + "name": "v_token_params", + "type": "core::array::Span::" + }, + { + "name": "ltv_params", + "type": "core::array::Span::" + }, + { + "name": "interest_rate_configs", + "type": "core::array::Span::" + }, + { + "name": "pragma_oracle_params", + "type": "core::array::Span::" + }, + { + "name": "liquidation_params", + "type": "core::array::Span::" + }, + { + "name": "shutdown_params", + "type": "vesu::extension::default_extension::ShutdownParams" + }, + { + "name": "fee_params", + "type": "vesu::extension::default_extension::FeeParams" + }, + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::felt252" + } + ], + "state_mutability": "external" + }, + { + "name": "add_asset", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset_params", + "type": "vesu::data_model::AssetParams" + }, + { + "name": "v_token_params", + "type": "vesu::extension::default_extension::VTokenParams" + }, + { + "name": "interest_rate_config", + "type": "vesu::extension::components::interest_rate_model::InterestRateConfig" + }, + { + "name": "pragma_oracle_params", + "type": "vesu::extension::default_extension::PragmaOracleParams" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_asset_parameter", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "parameter", + "type": "core::felt252" + }, + { + "name": "value", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_interest_rate_parameter", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "parameter", + "type": "core::felt252" + }, + { + "name": "value", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_oracle_parameter", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "parameter", + "type": "core::felt252" + }, + { + "name": "value", + "type": "core::integer::u64" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_liquidation_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "liquidation_config", + "type": "vesu::extension::components::position_hooks::LiquidationConfig" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_ltv_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "ltv_config", + "type": "vesu::data_model::LTVConfig" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_shutdown_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "shutdown_config", + "type": "vesu::extension::components::position_hooks::ShutdownConfig" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_shutdown_ltv_config", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "shutdown_ltv_config", + "type": "vesu::data_model::LTVConfig" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_extension", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "extension", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "set_pool_owner", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "name": "update_shutdown_status", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::extension::components::position_hooks::ShutdownMode" + } + ], + "state_mutability": "external" + }, + { + "name": "claim_fees", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "name": "ExtensionImpl", + "type": "impl", + "interface_name": "vesu::extension::interface::IExtension" + }, + { + "name": "vesu::data_model::AssetPrice", + "type": "struct", + "members": [ + { + "name": "value", + "type": "core::integer::u256" + }, + { + "name": "is_valid", + "type": "core::bool" + } + ] + }, + { + "name": "vesu::data_model::AssetConfig", + "type": "struct", + "members": [ + { + "name": "total_collateral_shares", + "type": "core::integer::u256" + }, + { + "name": "total_nominal_debt", + "type": "core::integer::u256" + }, + { + "name": "reserve", + "type": "core::integer::u256" + }, + { + "name": "max_utilization", + "type": "core::integer::u256" + }, + { + "name": "floor", + "type": "core::integer::u256" + }, + { + "name": "scale", + "type": "core::integer::u256" + }, + { + "name": "is_legacy", + "type": "core::bool" + }, + { + "name": "last_updated", + "type": "core::integer::u64" + }, + { + "name": "last_rate_accumulator", + "type": "core::integer::u256" + }, + { + "name": "last_full_utilization_rate", + "type": "core::integer::u256" + }, + { + "name": "fee_rate", + "type": "core::integer::u256" + } + ] + }, + { + "name": "vesu::data_model::Position", + "type": "struct", + "members": [ + { + "name": "collateral_shares", + "type": "core::integer::u256" + }, + { + "name": "nominal_debt", + "type": "core::integer::u256" + } + ] + }, + { + "name": "vesu::data_model::Context", + "type": "struct", + "members": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "extension", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "collateral_asset_config", + "type": "vesu::data_model::AssetConfig" + }, + { + "name": "debt_asset_config", + "type": "vesu::data_model::AssetConfig" + }, + { + "name": "collateral_asset_price", + "type": "vesu::data_model::AssetPrice" + }, + { + "name": "debt_asset_price", + "type": "vesu::data_model::AssetPrice" + }, + { + "name": "collateral_asset_fee_shares", + "type": "core::integer::u256" + }, + { + "name": "debt_asset_fee_shares", + "type": "core::integer::u256" + }, + { + "name": "max_ltv", + "type": "core::integer::u64" + }, + { + "name": "user", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "position", + "type": "vesu::data_model::Position" + } + ] + }, + { + "name": "vesu::data_model::AmountType", + "type": "enum", + "variants": [ + { + "name": "Delta", + "type": "()" + }, + { + "name": "Target", + "type": "()" + } + ] + }, + { + "name": "vesu::data_model::AmountDenomination", + "type": "enum", + "variants": [ + { + "name": "Native", + "type": "()" + }, + { + "name": "Assets", + "type": "()" + } + ] + }, + { + "name": "alexandria_math::i257::i257", + "type": "struct", + "members": [ + { + "name": "abs", + "type": "core::integer::u256" + }, + { + "name": "is_negative", + "type": "core::bool" + } + ] + }, + { + "name": "vesu::data_model::Amount", + "type": "struct", + "members": [ + { + "name": "amount_type", + "type": "vesu::data_model::AmountType" + }, + { + "name": "denomination", + "type": "vesu::data_model::AmountDenomination" + }, + { + "name": "value", + "type": "alexandria_math::i257::i257" + } + ] + }, + { + "name": "core::array::Span::", + "type": "struct", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "name": "vesu::data_model::UnsignedAmount", + "type": "struct", + "members": [ + { + "name": "amount_type", + "type": "vesu::data_model::AmountType" + }, + { + "name": "denomination", + "type": "vesu::data_model::AmountDenomination" + }, + { + "name": "value", + "type": "core::integer::u256" + } + ] + }, + { + "name": "vesu::extension::interface::IExtension", + "type": "interface", + "items": [ + { + "name": "singleton", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "name": "price", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "vesu::data_model::AssetPrice" + } + ], + "state_mutability": "view" + }, + { + "name": "interest_rate", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "utilization", + "type": "core::integer::u256" + }, + { + "name": "last_updated", + "type": "core::integer::u64" + }, + { + "name": "last_full_utilization_rate", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "name": "rate_accumulator", + "type": "function", + "inputs": [ + { + "name": "pool_id", + "type": "core::felt252" + }, + { + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "utilization", + "type": "core::integer::u256" + }, + { + "name": "last_updated", + "type": "core::integer::u64" + }, + { + "name": "last_rate_accumulator", + "type": "core::integer::u256" + }, + { + "name": "last_full_utilization_rate", + "type": "core::integer::u256" + } + ], + "outputs": [ + { + "type": "(core::integer::u256, core::integer::u256)" + } + ], + "state_mutability": "view" + }, + { + "name": "before_modify_position", + "type": "function", + "inputs": [ + { + "name": "context", + "type": "vesu::data_model::Context" + }, + { + "name": "collateral", + "type": "vesu::data_model::Amount" + }, + { + "name": "debt", + "type": "vesu::data_model::Amount" + }, + { + "name": "data", + "type": "core::array::Span::" + }, + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(vesu::data_model::Amount, vesu::data_model::Amount)" + } + ], + "state_mutability": "external" + }, + { + "name": "after_modify_position", + "type": "function", + "inputs": [ + { + "name": "context", + "type": "vesu::data_model::Context" + }, + { + "name": "collateral_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "collateral_shares_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "nominal_debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "data", + "type": "core::array::Span::" + }, + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "name": "before_transfer_position", + "type": "function", + "inputs": [ + { + "name": "from_context", + "type": "vesu::data_model::Context" + }, + { + "name": "to_context", + "type": "vesu::data_model::Context" + }, + { + "name": "collateral", + "type": "vesu::data_model::UnsignedAmount" + }, + { + "name": "debt", + "type": "vesu::data_model::UnsignedAmount" + }, + { + "name": "data", + "type": "core::array::Span::" + }, + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(vesu::data_model::UnsignedAmount, vesu::data_model::UnsignedAmount)" + } + ], + "state_mutability": "external" + }, + { + "name": "after_transfer_position", + "type": "function", + "inputs": [ + { + "name": "from_context", + "type": "vesu::data_model::Context" + }, + { + "name": "to_context", + "type": "vesu::data_model::Context" + }, + { + "name": "collateral_delta", + "type": "core::integer::u256" + }, + { + "name": "collateral_shares_delta", + "type": "core::integer::u256" + }, + { + "name": "debt_delta", + "type": "core::integer::u256" + }, + { + "name": "nominal_debt_delta", + "type": "core::integer::u256" + }, + { + "name": "data", + "type": "core::array::Span::" + }, + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + }, + { + "name": "before_liquidate_position", + "type": "function", + "inputs": [ + { + "name": "context", + "type": "vesu::data_model::Context" + }, + { + "name": "data", + "type": "core::array::Span::" + }, + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "(core::integer::u256, core::integer::u256, core::integer::u256)" + } + ], + "state_mutability": "external" + }, + { + "name": "after_liquidate_position", + "type": "function", + "inputs": [ + { + "name": "context", + "type": "vesu::data_model::Context" + }, + { + "name": "collateral_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "collateral_shares_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "nominal_debt_delta", + "type": "alexandria_math::i257::i257" + }, + { + "name": "bad_debt", + "type": "core::integer::u256" + }, + { + "name": "data", + "type": "core::array::Span::" + }, + { + "name": "caller", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "external" + } + ] + }, + { + "name": "constructor", + "type": "constructor", + "inputs": [ + { + "name": "singleton", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "oracle_address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "v_token_class_hash", + "type": "core::felt252" + } + ] + }, + { + "kind": "struct", + "name": "vesu::extension::components::position_hooks::position_hooks_component::SetLiquidationConfig", + "type": "event", + "members": [ + { + "kind": "data", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "liquidation_config", + "type": "vesu::extension::components::position_hooks::LiquidationConfig" + } + ] + }, + { + "kind": "struct", + "name": "vesu::extension::components::position_hooks::position_hooks_component::SetShutdownConfig", + "type": "event", + "members": [ + { + "kind": "data", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "shutdown_config", + "type": "vesu::extension::components::position_hooks::ShutdownConfig" + } + ] + }, + { + "kind": "struct", + "name": "vesu::extension::components::position_hooks::position_hooks_component::SetShutdownLTVConfig", + "type": "event", + "members": [ + { + "kind": "data", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "shutdown_ltv_config", + "type": "vesu::data_model::LTVConfig" + } + ] + }, + { + "kind": "enum", + "name": "vesu::extension::components::position_hooks::position_hooks_component::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "SetLiquidationConfig", + "type": "vesu::extension::components::position_hooks::position_hooks_component::SetLiquidationConfig" + }, + { + "kind": "nested", + "name": "SetShutdownConfig", + "type": "vesu::extension::components::position_hooks::position_hooks_component::SetShutdownConfig" + }, + { + "kind": "nested", + "name": "SetShutdownLTVConfig", + "type": "vesu::extension::components::position_hooks::position_hooks_component::SetShutdownLTVConfig" + } + ] + }, + { + "kind": "struct", + "name": "vesu::extension::components::interest_rate_model::interest_rate_model_component::SetInterestRateConfig", + "type": "event", + "members": [ + { + "kind": "data", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "interest_rate_config", + "type": "vesu::extension::components::interest_rate_model::InterestRateConfig" + } + ] + }, + { + "kind": "enum", + "name": "vesu::extension::components::interest_rate_model::interest_rate_model_component::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "SetInterestRateConfig", + "type": "vesu::extension::components::interest_rate_model::interest_rate_model_component::SetInterestRateConfig" + } + ] + }, + { + "kind": "struct", + "name": "vesu::extension::components::pragma_oracle::pragma_oracle_component::SetOracleConfig", + "type": "event", + "members": [ + { + "kind": "data", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "oracle_config", + "type": "vesu::extension::components::pragma_oracle::OracleConfig" + } + ] + }, + { + "kind": "struct", + "name": "vesu::extension::components::pragma_oracle::pragma_oracle_component::SetOracleParameter", + "type": "event", + "members": [ + { + "kind": "data", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "parameter", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "value", + "type": "core::integer::u64" + } + ] + }, + { + "kind": "enum", + "name": "vesu::extension::components::pragma_oracle::pragma_oracle_component::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "SetOracleConfig", + "type": "vesu::extension::components::pragma_oracle::pragma_oracle_component::SetOracleConfig" + }, + { + "kind": "nested", + "name": "SetOracleParameter", + "type": "vesu::extension::components::pragma_oracle::pragma_oracle_component::SetOracleParameter" + } + ] + }, + { + "kind": "enum", + "name": "vesu::map_list::map_list_component::Event", + "type": "event", + "variants": [] + }, + { + "kind": "struct", + "name": "vesu::extension::components::fee_model::fee_model_component::SetFeeConfig", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "fee_config", + "type": "vesu::extension::components::fee_model::FeeConfig" + } + ] + }, + { + "kind": "struct", + "name": "vesu::extension::components::fee_model::fee_model_component::ClaimFees", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "collateral_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "debt_asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "recipient", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "data", + "name": "amount", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "enum", + "name": "vesu::extension::components::fee_model::fee_model_component::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "SetFeeConfig", + "type": "vesu::extension::components::fee_model::fee_model_component::SetFeeConfig" + }, + { + "kind": "nested", + "name": "ClaimFees", + "type": "vesu::extension::components::fee_model::fee_model_component::ClaimFees" + } + ] + }, + { + "kind": "enum", + "name": "vesu::extension::components::tokenization::tokenization_component::Event", + "type": "event", + "variants": [] + }, + { + "kind": "struct", + "name": "vesu::extension::default_extension::DefaultExtension::SetAssetParameter", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "asset", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "kind": "key", + "name": "parameter", + "type": "core::felt252" + }, + { + "kind": "data", + "name": "value", + "type": "core::integer::u256" + } + ] + }, + { + "kind": "struct", + "name": "vesu::extension::default_extension::DefaultExtension::SetPoolOwner", + "type": "event", + "members": [ + { + "kind": "key", + "name": "pool_id", + "type": "core::felt252" + }, + { + "kind": "key", + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "kind": "enum", + "name": "vesu::extension::default_extension::DefaultExtension::Event", + "type": "event", + "variants": [ + { + "kind": "nested", + "name": "PositionHooksEvents", + "type": "vesu::extension::components::position_hooks::position_hooks_component::Event" + }, + { + "kind": "nested", + "name": "InterestRateModelEvents", + "type": "vesu::extension::components::interest_rate_model::interest_rate_model_component::Event" + }, + { + "kind": "nested", + "name": "PragmaOracleEvents", + "type": "vesu::extension::components::pragma_oracle::pragma_oracle_component::Event" + }, + { + "kind": "nested", + "name": "MapListEvents", + "type": "vesu::map_list::map_list_component::Event" + }, + { + "kind": "nested", + "name": "FeeModelEvents", + "type": "vesu::extension::components::fee_model::fee_model_component::Event" + }, + { + "kind": "nested", + "name": "TokenizationEvents", + "type": "vesu::extension::components::tokenization::tokenization_component::Event" + }, + { + "kind": "nested", + "name": "SetAssetParameter", + "type": "vesu::extension::default_extension::DefaultExtension::SetAssetParameter" + }, + { + "kind": "nested", + "name": "SetPoolOwner", + "type": "vesu::extension::default_extension::DefaultExtension::SetPoolOwner" + } + ] + } +] diff --git a/src/store/vesu.abi.json b/src/store/vesu.abi.json deleted file mode 100644 index b09b27d7..00000000 --- a/src/store/vesu.abi.json +++ /dev/null @@ -1,1903 +0,0 @@ -[ - { - "name": "SingletonImpl", - "type": "impl", - "interface_name": "vesu::singleton::ISingleton" - }, - { - "name": "core::integer::u256", - "type": "struct", - "members": [ - { - "name": "low", - "type": "core::integer::u128" - }, - { - "name": "high", - "type": "core::integer::u128" - } - ] - }, - { - "name": "core::bool", - "type": "enum", - "variants": [ - { - "name": "False", - "type": "()" - }, - { - "name": "True", - "type": "()" - } - ] - }, - { - "name": "vesu::data_model::AssetConfig", - "type": "struct", - "members": [ - { - "name": "total_collateral_shares", - "type": "core::integer::u256" - }, - { - "name": "total_nominal_debt", - "type": "core::integer::u256" - }, - { - "name": "reserve", - "type": "core::integer::u256" - }, - { - "name": "max_utilization", - "type": "core::integer::u256" - }, - { - "name": "floor", - "type": "core::integer::u256" - }, - { - "name": "scale", - "type": "core::integer::u256" - }, - { - "name": "is_legacy", - "type": "core::bool" - }, - { - "name": "last_updated", - "type": "core::integer::u64" - }, - { - "name": "last_rate_accumulator", - "type": "core::integer::u256" - }, - { - "name": "last_full_utilization_rate", - "type": "core::integer::u256" - }, - { - "name": "fee_rate", - "type": "core::integer::u256" - } - ] - }, - { - "name": "vesu::data_model::LTVConfig", - "type": "struct", - "members": [ - { - "name": "max_ltv", - "type": "core::integer::u64" - } - ] - }, - { - "name": "vesu::data_model::Position", - "type": "struct", - "members": [ - { - "name": "collateral_shares", - "type": "core::integer::u256" - }, - { - "name": "nominal_debt", - "type": "core::integer::u256" - } - ] - }, - { - "name": "alexandria_math::i257::i257", - "type": "struct", - "members": [ - { - "name": "abs", - "type": "core::integer::u256" - }, - { - "name": "is_negative", - "type": "core::bool" - } - ] - }, - { - "name": "vesu::data_model::AmountType", - "type": "enum", - "variants": [ - { - "name": "Delta", - "type": "()" - }, - { - "name": "Target", - "type": "()" - } - ] - }, - { - "name": "vesu::data_model::AmountDenomination", - "type": "enum", - "variants": [ - { - "name": "Native", - "type": "()" - }, - { - "name": "Assets", - "type": "()" - } - ] - }, - { - "name": "vesu::data_model::Amount", - "type": "struct", - "members": [ - { - "name": "amount_type", - "type": "vesu::data_model::AmountType" - }, - { - "name": "denomination", - "type": "vesu::data_model::AmountDenomination" - }, - { - "name": "value", - "type": "alexandria_math::i257::i257" - } - ] - }, - { - "name": "vesu::data_model::AssetPrice", - "type": "struct", - "members": [ - { - "name": "value", - "type": "core::integer::u256" - }, - { - "name": "is_valid", - "type": "core::bool" - } - ] - }, - { - "name": "vesu::data_model::Context", - "type": "struct", - "members": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "extension", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "collateral_asset_config", - "type": "vesu::data_model::AssetConfig" - }, - { - "name": "debt_asset_config", - "type": "vesu::data_model::AssetConfig" - }, - { - "name": "collateral_asset_price", - "type": "vesu::data_model::AssetPrice" - }, - { - "name": "debt_asset_price", - "type": "vesu::data_model::AssetPrice" - }, - { - "name": "collateral_asset_fee_shares", - "type": "core::integer::u256" - }, - { - "name": "debt_asset_fee_shares", - "type": "core::integer::u256" - }, - { - "name": "max_ltv", - "type": "core::integer::u64" - }, - { - "name": "user", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "position", - "type": "vesu::data_model::Position" - } - ] - }, - { - "name": "vesu::data_model::AssetParams", - "type": "struct", - "members": [ - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "floor", - "type": "core::integer::u256" - }, - { - "name": "initial_rate_accumulator", - "type": "core::integer::u256" - }, - { - "name": "initial_full_utilization_rate", - "type": "core::integer::u256" - }, - { - "name": "max_utilization", - "type": "core::integer::u256" - }, - { - "name": "is_legacy", - "type": "core::bool" - }, - { - "name": "fee_rate", - "type": "core::integer::u256" - } - ] - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "vesu::data_model::LTVParams", - "type": "struct", - "members": [ - { - "name": "collateral_asset_index", - "type": "core::integer::u32" - }, - { - "name": "debt_asset_index", - "type": "core::integer::u32" - }, - { - "name": "max_ltv", - "type": "core::integer::u64" - } - ] - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "vesu::data_model::ModifyPositionParams", - "type": "struct", - "members": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "user", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "collateral", - "type": "vesu::data_model::Amount" - }, - { - "name": "debt", - "type": "vesu::data_model::Amount" - }, - { - "name": "data", - "type": "core::array::Span::" - } - ] - }, - { - "name": "vesu::data_model::UpdatePositionResponse", - "type": "struct", - "members": [ - { - "name": "collateral_delta", - "type": "alexandria_math::i257::i257" - }, - { - "name": "collateral_shares_delta", - "type": "alexandria_math::i257::i257" - }, - { - "name": "debt_delta", - "type": "alexandria_math::i257::i257" - }, - { - "name": "nominal_debt_delta", - "type": "alexandria_math::i257::i257" - }, - { - "name": "bad_debt", - "type": "core::integer::u256" - } - ] - }, - { - "name": "vesu::data_model::UnsignedAmount", - "type": "struct", - "members": [ - { - "name": "amount_type", - "type": "vesu::data_model::AmountType" - }, - { - "name": "denomination", - "type": "vesu::data_model::AmountDenomination" - }, - { - "name": "value", - "type": "core::integer::u256" - } - ] - }, - { - "name": "vesu::data_model::TransferPositionParams", - "type": "struct", - "members": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "from_collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "from_debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "to_collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "to_debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "from_user", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "to_user", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "collateral", - "type": "vesu::data_model::UnsignedAmount" - }, - { - "name": "debt", - "type": "vesu::data_model::UnsignedAmount" - }, - { - "name": "from_data", - "type": "core::array::Span::" - }, - { - "name": "to_data", - "type": "core::array::Span::" - } - ] - }, - { - "name": "vesu::data_model::LiquidatePositionParams", - "type": "struct", - "members": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "user", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "receive_as_shares", - "type": "core::bool" - }, - { - "name": "data", - "type": "core::array::Span::" - } - ] - }, - { - "name": "vesu::singleton::ISingleton", - "type": "interface", - "items": [ - { - "name": "creator_nonce", - "type": "function", - "inputs": [ - { - "name": "creator", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "extension", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "state_mutability": "view" - }, - { - "name": "asset_config_unsafe", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "(vesu::data_model::AssetConfig, core::integer::u256)" - } - ], - "state_mutability": "view" - }, - { - "name": "asset_config", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "(vesu::data_model::AssetConfig, core::integer::u256)" - } - ], - "state_mutability": "external" - }, - { - "name": "ltv_config", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "vesu::data_model::LTVConfig" - } - ], - "state_mutability": "view" - }, - { - "name": "position_unsafe", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "user", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "(vesu::data_model::Position, core::integer::u256, core::integer::u256)" - } - ], - "state_mutability": "view" - }, - { - "name": "position", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "user", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "(vesu::data_model::Position, core::integer::u256, core::integer::u256)" - } - ], - "state_mutability": "external" - }, - { - "name": "check_collateralization_unsafe", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "user", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "(core::bool, core::integer::u256, core::integer::u256)" - } - ], - "state_mutability": "view" - }, - { - "name": "check_collateralization", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "user", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "(core::bool, core::integer::u256, core::integer::u256)" - } - ], - "state_mutability": "external" - }, - { - "name": "rate_accumulator_unsafe", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::integer::u256" - } - ], - "state_mutability": "view" - }, - { - "name": "rate_accumulator", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::integer::u256" - } - ], - "state_mutability": "external" - }, - { - "name": "utilization_unsafe", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::integer::u256" - } - ], - "state_mutability": "view" - }, - { - "name": "utilization", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::integer::u256" - } - ], - "state_mutability": "external" - }, - { - "name": "delegation", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "delegator", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "delegatee", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "view" - }, - { - "name": "calculate_pool_id", - "type": "function", - "inputs": [ - { - "name": "caller_address", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "nonce", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "name": "calculate_debt", - "type": "function", - "inputs": [ - { - "name": "nominal_debt", - "type": "alexandria_math::i257::i257" - }, - { - "name": "rate_accumulator", - "type": "core::integer::u256" - }, - { - "name": "asset_scale", - "type": "core::integer::u256" - } - ], - "outputs": [ - { - "type": "core::integer::u256" - } - ], - "state_mutability": "view" - }, - { - "name": "calculate_nominal_debt", - "type": "function", - "inputs": [ - { - "name": "debt", - "type": "alexandria_math::i257::i257" - }, - { - "name": "rate_accumulator", - "type": "core::integer::u256" - }, - { - "name": "asset_scale", - "type": "core::integer::u256" - } - ], - "outputs": [ - { - "type": "core::integer::u256" - } - ], - "state_mutability": "view" - }, - { - "name": "calculate_collateral_shares_unsafe", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "collateral", - "type": "alexandria_math::i257::i257" - } - ], - "outputs": [ - { - "type": "core::integer::u256" - } - ], - "state_mutability": "view" - }, - { - "name": "calculate_collateral_shares", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "collateral", - "type": "alexandria_math::i257::i257" - } - ], - "outputs": [ - { - "type": "core::integer::u256" - } - ], - "state_mutability": "external" - }, - { - "name": "calculate_collateral_unsafe", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "collateral_shares", - "type": "alexandria_math::i257::i257" - } - ], - "outputs": [ - { - "type": "core::integer::u256" - } - ], - "state_mutability": "view" - }, - { - "name": "calculate_collateral", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "collateral_shares", - "type": "alexandria_math::i257::i257" - } - ], - "outputs": [ - { - "type": "core::integer::u256" - } - ], - "state_mutability": "external" - }, - { - "name": "deconstruct_collateral_amount_unsafe", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "user", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "collateral", - "type": "vesu::data_model::Amount" - } - ], - "outputs": [ - { - "type": "(alexandria_math::i257::i257, alexandria_math::i257::i257)" - } - ], - "state_mutability": "view" - }, - { - "name": "deconstruct_collateral_amount", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "user", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "collateral", - "type": "vesu::data_model::Amount" - } - ], - "outputs": [ - { - "type": "(alexandria_math::i257::i257, alexandria_math::i257::i257)" - } - ], - "state_mutability": "external" - }, - { - "name": "deconstruct_debt_amount_unsafe", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "user", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt", - "type": "vesu::data_model::Amount" - } - ], - "outputs": [ - { - "type": "(alexandria_math::i257::i257, alexandria_math::i257::i257)" - } - ], - "state_mutability": "view" - }, - { - "name": "deconstruct_debt_amount", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "user", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt", - "type": "vesu::data_model::Amount" - } - ], - "outputs": [ - { - "type": "(alexandria_math::i257::i257, alexandria_math::i257::i257)" - } - ], - "state_mutability": "external" - }, - { - "name": "context_unsafe", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "user", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "vesu::data_model::Context" - } - ], - "state_mutability": "view" - }, - { - "name": "context", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "user", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "vesu::data_model::Context" - } - ], - "state_mutability": "external" - }, - { - "name": "create_pool", - "type": "function", - "inputs": [ - { - "name": "asset_params", - "type": "core::array::Span::" - }, - { - "name": "ltv_params", - "type": "core::array::Span::" - }, - { - "name": "extension", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "external" - }, - { - "name": "modify_position", - "type": "function", - "inputs": [ - { - "name": "params", - "type": "vesu::data_model::ModifyPositionParams" - } - ], - "outputs": [ - { - "type": "vesu::data_model::UpdatePositionResponse" - } - ], - "state_mutability": "external" - }, - { - "name": "transfer_position", - "type": "function", - "inputs": [ - { - "name": "params", - "type": "vesu::data_model::TransferPositionParams" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "liquidate_position", - "type": "function", - "inputs": [ - { - "name": "params", - "type": "vesu::data_model::LiquidatePositionParams" - } - ], - "outputs": [ - { - "type": "vesu::data_model::UpdatePositionResponse" - } - ], - "state_mutability": "external" - }, - { - "name": "flash_loan", - "type": "function", - "inputs": [ - { - "name": "receiver", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "amount", - "type": "core::integer::u256" - }, - { - "name": "is_legacy", - "type": "core::bool" - }, - { - "name": "data", - "type": "core::array::Span::" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "modify_delegation", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "delegatee", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "delegation", - "type": "core::bool" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "donate_to_reserve", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "amount", - "type": "core::integer::u256" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "retrieve_from_reserve", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "receiver", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "amount", - "type": "core::integer::u256" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "set_asset_config", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "params", - "type": "vesu::data_model::AssetParams" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "set_ltv_config", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "ltv_config", - "type": "vesu::data_model::LTVConfig" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "set_asset_parameter", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "parameter", - "type": "core::felt252" - }, - { - "name": "value", - "type": "core::integer::u256" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "set_extension", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "extension", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "claim_fee_shares", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "kind": "struct", - "name": "vesu::singleton::Singleton::CreatePool", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "key", - "name": "extension", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "creator", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "kind": "struct", - "name": "vesu::singleton::Singleton::ModifyPosition", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "key", - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "user", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "collateral_delta", - "type": "alexandria_math::i257::i257" - }, - { - "kind": "data", - "name": "collateral_shares_delta", - "type": "alexandria_math::i257::i257" - }, - { - "kind": "data", - "name": "debt_delta", - "type": "alexandria_math::i257::i257" - }, - { - "kind": "data", - "name": "nominal_debt_delta", - "type": "alexandria_math::i257::i257" - } - ] - }, - { - "kind": "struct", - "name": "vesu::singleton::Singleton::TransferPosition", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "key", - "name": "from_collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "from_debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "to_collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "to_debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "from_user", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "to_user", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "kind": "struct", - "name": "vesu::singleton::Singleton::LiquidatePosition", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "key", - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "user", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "liquidator", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "collateral_delta", - "type": "alexandria_math::i257::i257" - }, - { - "kind": "data", - "name": "collateral_shares_delta", - "type": "alexandria_math::i257::i257" - }, - { - "kind": "data", - "name": "debt_delta", - "type": "alexandria_math::i257::i257" - }, - { - "kind": "data", - "name": "nominal_debt_delta", - "type": "alexandria_math::i257::i257" - }, - { - "kind": "data", - "name": "bad_debt", - "type": "core::integer::u256" - } - ] - }, - { - "kind": "struct", - "name": "vesu::singleton::Singleton::AccrueFees", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "key", - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "recipient", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "fee_shares", - "type": "core::integer::u256" - } - ] - }, - { - "kind": "struct", - "name": "vesu::singleton::Singleton::UpdateContext", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "key", - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "collateral_asset_config", - "type": "vesu::data_model::AssetConfig" - }, - { - "kind": "data", - "name": "debt_asset_config", - "type": "vesu::data_model::AssetConfig" - }, - { - "kind": "data", - "name": "collateral_asset_price", - "type": "vesu::data_model::AssetPrice" - }, - { - "kind": "data", - "name": "debt_asset_price", - "type": "vesu::data_model::AssetPrice" - } - ] - }, - { - "kind": "struct", - "name": "vesu::singleton::Singleton::Flashloan", - "type": "event", - "members": [ - { - "kind": "key", - "name": "sender", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "receiver", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "amount", - "type": "core::integer::u256" - } - ] - }, - { - "kind": "struct", - "name": "vesu::singleton::Singleton::ModifyDelegation", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "key", - "name": "delegator", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "delegatee", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "delegation", - "type": "core::bool" - } - ] - }, - { - "kind": "struct", - "name": "vesu::singleton::Singleton::Donate", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "key", - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "amount", - "type": "core::integer::u256" - } - ] - }, - { - "kind": "struct", - "name": "vesu::singleton::Singleton::RetrieveReserve", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "key", - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "receiver", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "kind": "struct", - "name": "vesu::singleton::Singleton::SetLTVConfig", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "key", - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "ltv_config", - "type": "vesu::data_model::LTVConfig" - } - ] - }, - { - "kind": "struct", - "name": "vesu::singleton::Singleton::SetAssetConfig", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "key", - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "kind": "struct", - "name": "vesu::singleton::Singleton::SetAssetParameter", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "key", - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "parameter", - "type": "core::felt252" - }, - { - "kind": "data", - "name": "value", - "type": "core::integer::u256" - } - ] - }, - { - "kind": "struct", - "name": "vesu::singleton::Singleton::SetExtension", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "key", - "name": "extension", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "kind": "enum", - "name": "vesu::singleton::Singleton::Event", - "type": "event", - "variants": [ - { - "kind": "nested", - "name": "CreatePool", - "type": "vesu::singleton::Singleton::CreatePool" - }, - { - "kind": "nested", - "name": "ModifyPosition", - "type": "vesu::singleton::Singleton::ModifyPosition" - }, - { - "kind": "nested", - "name": "TransferPosition", - "type": "vesu::singleton::Singleton::TransferPosition" - }, - { - "kind": "nested", - "name": "LiquidatePosition", - "type": "vesu::singleton::Singleton::LiquidatePosition" - }, - { - "kind": "nested", - "name": "AccrueFees", - "type": "vesu::singleton::Singleton::AccrueFees" - }, - { - "kind": "nested", - "name": "UpdateContext", - "type": "vesu::singleton::Singleton::UpdateContext" - }, - { - "kind": "nested", - "name": "Flashloan", - "type": "vesu::singleton::Singleton::Flashloan" - }, - { - "kind": "nested", - "name": "ModifyDelegation", - "type": "vesu::singleton::Singleton::ModifyDelegation" - }, - { - "kind": "nested", - "name": "Donate", - "type": "vesu::singleton::Singleton::Donate" - }, - { - "kind": "nested", - "name": "RetrieveReserve", - "type": "vesu::singleton::Singleton::RetrieveReserve" - }, - { - "kind": "nested", - "name": "SetLTVConfig", - "type": "vesu::singleton::Singleton::SetLTVConfig" - }, - { - "kind": "nested", - "name": "SetAssetConfig", - "type": "vesu::singleton::Singleton::SetAssetConfig" - }, - { - "kind": "nested", - "name": "SetAssetParameter", - "type": "vesu::singleton::Singleton::SetAssetParameter" - }, - { - "kind": "nested", - "name": "SetExtension", - "type": "vesu::singleton::Singleton::SetExtension" - } - ] - } -] \ No newline at end of file diff --git a/src/store/vesu.store.ts b/src/store/vesu.store.ts index 2e6df22c..d16a3f6f 100644 --- a/src/store/vesu.store.ts +++ b/src/store/vesu.store.ts @@ -1,11 +1,10 @@ +import vesuAbi from '@/abi/vesu.abi.json'; +import vesuInterestRateAbi from '@/abi/vesuInterestRate.abi.json'; import CONSTANTS, { TokenName } from '@/constants'; -import { Category, PoolType } from './pools'; import { atom } from 'jotai'; -import { PoolInfo, ProtocolAtoms } from './pools'; -import { Jediswap } from './jedi.store'; import { Contract, RpcProvider } from 'starknet'; -import vesuAbi from './vesu.abi.json'; -import vesuInterestRateAbi from './vesuInterestRate.abi.json'; +import { Jediswap } from './jedi.store'; +import { Category, PoolInfo, PoolType, ProtocolAtoms } from './pools'; // Initialize the provider const provider = new RpcProvider({ nodeUrl: process.env.NEXT_PUBLIC_RPC_URL }); @@ -25,10 +24,13 @@ const getUtilisation = async (poolId: string, tokenAddress: string) => { const contract = new Contract( VesuAbi, '0x02545b2e5d519fc230e9cd781046d3a64e092114f07e44771e0d719d148725ef', - provider + provider, ); const poolidHex = toBigIntHex(poolId); - const res: any = await contract.call('utilization_unsafe', [poolidHex, tokenAddress]); + const res: any = await contract.call('utilization_unsafe', [ + poolidHex, + tokenAddress, + ]); return res; }; @@ -37,11 +39,14 @@ const getAssetInfo = async (poolId: string, tokenAddress: string) => { const contract = new Contract( VesuAbi, '0x02545b2e5d519fc230e9cd781046d3a64e092114f07e44771e0d719d148725ef', - provider + provider, ); const poolidHex = toBigIntHex(poolId); - const res: any = await contract.call('asset_config_unsafe', [poolidHex, tokenAddress]); + const res: any = await contract.call('asset_config_unsafe', [ + poolidHex, + tokenAddress, + ]); return res[0]; }; @@ -50,24 +55,24 @@ const getBaseApy = async (poolId: string, tokenAddress: string) => { const contract = new Contract( VesuInterestRateAbi, '0x002334189e831d804d4a11d3f71d4a982ec82614ac12ed2e9ca2f8da4e6374fa', - provider + provider, ); - const poolidHex = toBigIntHex(poolId); const utilization = await getUtilisation(poolId, tokenAddress); const assetInfo = await getAssetInfo(poolId, tokenAddress); - const res: any = await contract.call('interest_rate', [ - poolidHex, + + const interestRate = await contract.call('interest_rate', [ + poolId, tokenAddress, utilization, assetInfo.last_updated, assetInfo.last_full_utilization_rate, ]); - const interestRate = res[0]; + const apy = (Number(utilization) / 10 ** 18) * ((1 + Number(interestRate) / 10 ** 18) ** (360 * 86400) - 1); - console.log(apy); + return apy; }; @@ -77,8 +82,10 @@ const poolsData = [ id: 'ETH', isVesu: true, tokenA: 'ETH', - poolId: '2198503327643286920898110335698706244522220458610657370981979460625005526824', - tokenAddress: '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7', + poolId: + '2198503327643286920898110335698706244522220458610657370981979460625005526824', + tokenAddress: + '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7', rewardApr: '0.09', baseApr: '0', tvl: '1000000', @@ -87,8 +94,10 @@ const poolsData = [ id: 'STRK', isVesu: true, tokenA: 'STRK', - poolId: '2198503327643286920898110335698706244522220458610657370981979460625005526824', - tokenAddress: '0x4718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d', + poolId: + '2198503327643286920898110335698706244522220458610657370981979460625005526824', + tokenAddress: + '0x4718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d', rewardApr: '0.13', baseApr: '0', tvl: '2000000', @@ -97,8 +106,10 @@ const poolsData = [ id: 'USDC', isVesu: true, tokenA: 'USDC', - poolId: '2198503327643286920898110335698706244522220458610657370981979460625005526824', - tokenAddress: '0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8', + poolId: + '2198503327643286920898110335698706244522220458610657370981979460625005526824', + tokenAddress: + '0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8', rewardApr: '0.10', baseApr: '0', tvl: '2000000', @@ -107,8 +118,10 @@ const poolsData = [ id: 'USDT', isVesu: true, tokenA: 'USDT', - poolId: '2198503327643286920898110335698706244522220458610657370981979460625005526824', - tokenAddress: '0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8', + poolId: + '2198503327643286920898110335698706244522220458610657370981979460625005526824', + tokenAddress: + '0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8', rewardApr: '0.10', baseApr: '0', tvl: '2000000', @@ -120,17 +133,13 @@ async function fetchAndUpdatePoolsData() { for (const pool of poolsData) { const res = await getBaseApy(pool.poolId, pool.tokenAddress); pool.baseApr = res.toString(); - console.log(`pool base apr ${ pool.baseApr}`); + console.log(res, pool.id, 'pool-res'); } } -(async function fetchAndInitializePoolsData() { - const res = await fetchAndUpdatePoolsData(); - console.log(res); - return res; -}()).catch((err) => { - console.error("Error fetching and updating pools data:", err); -}); +fetchAndUpdatePoolsData(); + +console.log(poolsData, 'updated-pool-data'); export class Vesu extends Jediswap { name = 'Vesu.xyz'; @@ -206,4 +215,4 @@ const VesuAtoms: ProtocolAtoms = { }), }; -export default VesuAtoms; \ No newline at end of file +export default VesuAtoms; diff --git a/src/store/vesuInterestRate.abi.json b/src/store/vesuInterestRate.abi.json deleted file mode 100644 index b781b006..00000000 --- a/src/store/vesuInterestRate.abi.json +++ /dev/null @@ -1,1946 +0,0 @@ -[ - { - "name": "DefaultExtensionImpl", - "type": "impl", - "interface_name": "vesu::extension::default_extension::IDefaultExtension" - }, - { - "name": "vesu::extension::components::pragma_oracle::OracleConfig", - "type": "struct", - "members": [ - { - "name": "pragma_key", - "type": "core::felt252" - }, - { - "name": "timeout", - "type": "core::integer::u64" - }, - { - "name": "number_of_sources", - "type": "core::integer::u32" - } - ] - }, - { - "name": "vesu::extension::components::fee_model::FeeConfig", - "type": "struct", - "members": [ - { - "name": "fee_recipient", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "name": "core::integer::u256", - "type": "struct", - "members": [ - { - "name": "low", - "type": "core::integer::u128" - }, - { - "name": "high", - "type": "core::integer::u128" - } - ] - }, - { - "name": "vesu::extension::components::interest_rate_model::InterestRateConfig", - "type": "struct", - "members": [ - { - "name": "min_target_utilization", - "type": "core::integer::u256" - }, - { - "name": "max_target_utilization", - "type": "core::integer::u256" - }, - { - "name": "target_utilization", - "type": "core::integer::u256" - }, - { - "name": "min_full_utilization_rate", - "type": "core::integer::u256" - }, - { - "name": "max_full_utilization_rate", - "type": "core::integer::u256" - }, - { - "name": "zero_utilization_rate", - "type": "core::integer::u256" - }, - { - "name": "rate_half_life", - "type": "core::integer::u256" - }, - { - "name": "target_rate_percent", - "type": "core::integer::u256" - } - ] - }, - { - "name": "vesu::extension::components::position_hooks::LiquidationConfig", - "type": "struct", - "members": [ - { - "name": "liquidation_factor", - "type": "core::integer::u64" - } - ] - }, - { - "name": "vesu::extension::components::position_hooks::ShutdownConfig", - "type": "struct", - "members": [ - { - "name": "recovery_period", - "type": "core::integer::u64" - }, - { - "name": "subscription_period", - "type": "core::integer::u64" - } - ] - }, - { - "name": "vesu::data_model::LTVConfig", - "type": "struct", - "members": [ - { - "name": "max_ltv", - "type": "core::integer::u64" - } - ] - }, - { - "name": "vesu::extension::components::position_hooks::ShutdownMode", - "type": "enum", - "variants": [ - { - "name": "None", - "type": "()" - }, - { - "name": "Recovery", - "type": "()" - }, - { - "name": "Subscription", - "type": "()" - }, - { - "name": "Redemption", - "type": "()" - } - ] - }, - { - "name": "core::bool", - "type": "enum", - "variants": [ - { - "name": "False", - "type": "()" - }, - { - "name": "True", - "type": "()" - } - ] - }, - { - "name": "vesu::extension::components::position_hooks::ShutdownStatus", - "type": "struct", - "members": [ - { - "name": "shutdown_mode", - "type": "vesu::extension::components::position_hooks::ShutdownMode" - }, - { - "name": "violating", - "type": "core::bool" - }, - { - "name": "previous_violation_timestamp", - "type": "core::integer::u64" - }, - { - "name": "count_at_violation_timestamp", - "type": "core::integer::u128" - } - ] - }, - { - "name": "vesu::extension::components::position_hooks::Pair", - "type": "struct", - "members": [ - { - "name": "total_collateral_shares", - "type": "core::integer::u256" - }, - { - "name": "total_nominal_debt", - "type": "core::integer::u256" - } - ] - }, - { - "name": "vesu::data_model::AssetParams", - "type": "struct", - "members": [ - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "floor", - "type": "core::integer::u256" - }, - { - "name": "initial_rate_accumulator", - "type": "core::integer::u256" - }, - { - "name": "initial_full_utilization_rate", - "type": "core::integer::u256" - }, - { - "name": "max_utilization", - "type": "core::integer::u256" - }, - { - "name": "is_legacy", - "type": "core::bool" - }, - { - "name": "fee_rate", - "type": "core::integer::u256" - } - ] - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "vesu::extension::default_extension::VTokenParams", - "type": "struct", - "members": [ - { - "name": "v_token_name", - "type": "core::felt252" - }, - { - "name": "v_token_symbol", - "type": "core::felt252" - } - ] - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "vesu::data_model::LTVParams", - "type": "struct", - "members": [ - { - "name": "collateral_asset_index", - "type": "core::integer::u32" - }, - { - "name": "debt_asset_index", - "type": "core::integer::u32" - }, - { - "name": "max_ltv", - "type": "core::integer::u64" - } - ] - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "vesu::extension::default_extension::PragmaOracleParams", - "type": "struct", - "members": [ - { - "name": "pragma_key", - "type": "core::felt252" - }, - { - "name": "timeout", - "type": "core::integer::u64" - }, - { - "name": "number_of_sources", - "type": "core::integer::u32" - } - ] - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "vesu::extension::default_extension::LiquidationParams", - "type": "struct", - "members": [ - { - "name": "collateral_asset_index", - "type": "core::integer::u32" - }, - { - "name": "debt_asset_index", - "type": "core::integer::u32" - }, - { - "name": "liquidation_factor", - "type": "core::integer::u64" - } - ] - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "vesu::extension::default_extension::ShutdownParams", - "type": "struct", - "members": [ - { - "name": "recovery_period", - "type": "core::integer::u64" - }, - { - "name": "subscription_period", - "type": "core::integer::u64" - }, - { - "name": "ltv_params", - "type": "core::array::Span::" - } - ] - }, - { - "name": "vesu::extension::default_extension::FeeParams", - "type": "struct", - "members": [ - { - "name": "fee_recipient", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "name": "vesu::extension::default_extension::IDefaultExtension", - "type": "interface", - "items": [ - { - "name": "pool_owner", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "state_mutability": "view" - }, - { - "name": "pragma_oracle", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "state_mutability": "view" - }, - { - "name": "oracle_config", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "vesu::extension::components::pragma_oracle::OracleConfig" - } - ], - "state_mutability": "view" - }, - { - "name": "fee_config", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "vesu::extension::components::fee_model::FeeConfig" - } - ], - "state_mutability": "view" - }, - { - "name": "interest_rate_config", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "vesu::extension::components::interest_rate_model::InterestRateConfig" - } - ], - "state_mutability": "view" - }, - { - "name": "liquidation_config", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "vesu::extension::components::position_hooks::LiquidationConfig" - } - ], - "state_mutability": "view" - }, - { - "name": "shutdown_config", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "vesu::extension::components::position_hooks::ShutdownConfig" - } - ], - "state_mutability": "view" - }, - { - "name": "shutdown_ltv_config", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "vesu::data_model::LTVConfig" - } - ], - "state_mutability": "view" - }, - { - "name": "shutdown_status", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "vesu::extension::components::position_hooks::ShutdownStatus" - } - ], - "state_mutability": "view" - }, - { - "name": "pairs", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "vesu::extension::components::position_hooks::Pair" - } - ], - "state_mutability": "view" - }, - { - "name": "violation_timestamp_for_pair", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::integer::u64" - } - ], - "state_mutability": "view" - }, - { - "name": "violation_timestamp_count", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "violation_timestamp", - "type": "core::integer::u64" - } - ], - "outputs": [ - { - "type": "core::integer::u128" - } - ], - "state_mutability": "view" - }, - { - "name": "oldest_violation_timestamp", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - } - ], - "outputs": [ - { - "type": "core::integer::u64" - } - ], - "state_mutability": "view" - }, - { - "name": "next_violation_timestamp", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "violation_timestamp", - "type": "core::integer::u64" - } - ], - "outputs": [ - { - "type": "core::integer::u64" - } - ], - "state_mutability": "view" - }, - { - "name": "v_token_for_collateral_asset", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "state_mutability": "view" - }, - { - "name": "collateral_asset_for_v_token", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "v_token", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "state_mutability": "view" - }, - { - "name": "create_pool", - "type": "function", - "inputs": [ - { - "name": "asset_params", - "type": "core::array::Span::" - }, - { - "name": "v_token_params", - "type": "core::array::Span::" - }, - { - "name": "ltv_params", - "type": "core::array::Span::" - }, - { - "name": "interest_rate_configs", - "type": "core::array::Span::" - }, - { - "name": "pragma_oracle_params", - "type": "core::array::Span::" - }, - { - "name": "liquidation_params", - "type": "core::array::Span::" - }, - { - "name": "shutdown_params", - "type": "vesu::extension::default_extension::ShutdownParams" - }, - { - "name": "fee_params", - "type": "vesu::extension::default_extension::FeeParams" - }, - { - "name": "owner", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "external" - }, - { - "name": "add_asset", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset_params", - "type": "vesu::data_model::AssetParams" - }, - { - "name": "v_token_params", - "type": "vesu::extension::default_extension::VTokenParams" - }, - { - "name": "interest_rate_config", - "type": "vesu::extension::components::interest_rate_model::InterestRateConfig" - }, - { - "name": "pragma_oracle_params", - "type": "vesu::extension::default_extension::PragmaOracleParams" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "set_asset_parameter", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "parameter", - "type": "core::felt252" - }, - { - "name": "value", - "type": "core::integer::u256" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "set_interest_rate_parameter", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "parameter", - "type": "core::felt252" - }, - { - "name": "value", - "type": "core::integer::u256" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "set_oracle_parameter", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "parameter", - "type": "core::felt252" - }, - { - "name": "value", - "type": "core::integer::u64" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "set_liquidation_config", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "liquidation_config", - "type": "vesu::extension::components::position_hooks::LiquidationConfig" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "set_ltv_config", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "ltv_config", - "type": "vesu::data_model::LTVConfig" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "set_shutdown_config", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "shutdown_config", - "type": "vesu::extension::components::position_hooks::ShutdownConfig" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "set_shutdown_ltv_config", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "shutdown_ltv_config", - "type": "vesu::data_model::LTVConfig" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "set_extension", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "extension", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "set_pool_owner", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "owner", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "name": "update_shutdown_status", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "vesu::extension::components::position_hooks::ShutdownMode" - } - ], - "state_mutability": "external" - }, - { - "name": "claim_fees", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "name": "ExtensionImpl", - "type": "impl", - "interface_name": "vesu::extension::interface::IExtension" - }, - { - "name": "vesu::data_model::AssetPrice", - "type": "struct", - "members": [ - { - "name": "value", - "type": "core::integer::u256" - }, - { - "name": "is_valid", - "type": "core::bool" - } - ] - }, - { - "name": "vesu::data_model::AssetConfig", - "type": "struct", - "members": [ - { - "name": "total_collateral_shares", - "type": "core::integer::u256" - }, - { - "name": "total_nominal_debt", - "type": "core::integer::u256" - }, - { - "name": "reserve", - "type": "core::integer::u256" - }, - { - "name": "max_utilization", - "type": "core::integer::u256" - }, - { - "name": "floor", - "type": "core::integer::u256" - }, - { - "name": "scale", - "type": "core::integer::u256" - }, - { - "name": "is_legacy", - "type": "core::bool" - }, - { - "name": "last_updated", - "type": "core::integer::u64" - }, - { - "name": "last_rate_accumulator", - "type": "core::integer::u256" - }, - { - "name": "last_full_utilization_rate", - "type": "core::integer::u256" - }, - { - "name": "fee_rate", - "type": "core::integer::u256" - } - ] - }, - { - "name": "vesu::data_model::Position", - "type": "struct", - "members": [ - { - "name": "collateral_shares", - "type": "core::integer::u256" - }, - { - "name": "nominal_debt", - "type": "core::integer::u256" - } - ] - }, - { - "name": "vesu::data_model::Context", - "type": "struct", - "members": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "extension", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "collateral_asset_config", - "type": "vesu::data_model::AssetConfig" - }, - { - "name": "debt_asset_config", - "type": "vesu::data_model::AssetConfig" - }, - { - "name": "collateral_asset_price", - "type": "vesu::data_model::AssetPrice" - }, - { - "name": "debt_asset_price", - "type": "vesu::data_model::AssetPrice" - }, - { - "name": "collateral_asset_fee_shares", - "type": "core::integer::u256" - }, - { - "name": "debt_asset_fee_shares", - "type": "core::integer::u256" - }, - { - "name": "max_ltv", - "type": "core::integer::u64" - }, - { - "name": "user", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "position", - "type": "vesu::data_model::Position" - } - ] - }, - { - "name": "vesu::data_model::AmountType", - "type": "enum", - "variants": [ - { - "name": "Delta", - "type": "()" - }, - { - "name": "Target", - "type": "()" - } - ] - }, - { - "name": "vesu::data_model::AmountDenomination", - "type": "enum", - "variants": [ - { - "name": "Native", - "type": "()" - }, - { - "name": "Assets", - "type": "()" - } - ] - }, - { - "name": "alexandria_math::i257::i257", - "type": "struct", - "members": [ - { - "name": "abs", - "type": "core::integer::u256" - }, - { - "name": "is_negative", - "type": "core::bool" - } - ] - }, - { - "name": "vesu::data_model::Amount", - "type": "struct", - "members": [ - { - "name": "amount_type", - "type": "vesu::data_model::AmountType" - }, - { - "name": "denomination", - "type": "vesu::data_model::AmountDenomination" - }, - { - "name": "value", - "type": "alexandria_math::i257::i257" - } - ] - }, - { - "name": "core::array::Span::", - "type": "struct", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "name": "vesu::data_model::UnsignedAmount", - "type": "struct", - "members": [ - { - "name": "amount_type", - "type": "vesu::data_model::AmountType" - }, - { - "name": "denomination", - "type": "vesu::data_model::AmountDenomination" - }, - { - "name": "value", - "type": "core::integer::u256" - } - ] - }, - { - "name": "vesu::extension::interface::IExtension", - "type": "interface", - "items": [ - { - "name": "singleton", - "type": "function", - "inputs": [], - "outputs": [ - { - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "state_mutability": "view" - }, - { - "name": "price", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "vesu::data_model::AssetPrice" - } - ], - "state_mutability": "view" - }, - { - "name": "interest_rate", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "utilization", - "type": "core::integer::u256" - }, - { - "name": "last_updated", - "type": "core::integer::u64" - }, - { - "name": "last_full_utilization_rate", - "type": "core::integer::u256" - } - ], - "outputs": [ - { - "type": "core::integer::u256" - } - ], - "state_mutability": "view" - }, - { - "name": "rate_accumulator", - "type": "function", - "inputs": [ - { - "name": "pool_id", - "type": "core::felt252" - }, - { - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "utilization", - "type": "core::integer::u256" - }, - { - "name": "last_updated", - "type": "core::integer::u64" - }, - { - "name": "last_rate_accumulator", - "type": "core::integer::u256" - }, - { - "name": "last_full_utilization_rate", - "type": "core::integer::u256" - } - ], - "outputs": [ - { - "type": "(core::integer::u256, core::integer::u256)" - } - ], - "state_mutability": "view" - }, - { - "name": "before_modify_position", - "type": "function", - "inputs": [ - { - "name": "context", - "type": "vesu::data_model::Context" - }, - { - "name": "collateral", - "type": "vesu::data_model::Amount" - }, - { - "name": "debt", - "type": "vesu::data_model::Amount" - }, - { - "name": "data", - "type": "core::array::Span::" - }, - { - "name": "caller", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "(vesu::data_model::Amount, vesu::data_model::Amount)" - } - ], - "state_mutability": "external" - }, - { - "name": "after_modify_position", - "type": "function", - "inputs": [ - { - "name": "context", - "type": "vesu::data_model::Context" - }, - { - "name": "collateral_delta", - "type": "alexandria_math::i257::i257" - }, - { - "name": "collateral_shares_delta", - "type": "alexandria_math::i257::i257" - }, - { - "name": "debt_delta", - "type": "alexandria_math::i257::i257" - }, - { - "name": "nominal_debt_delta", - "type": "alexandria_math::i257::i257" - }, - { - "name": "data", - "type": "core::array::Span::" - }, - { - "name": "caller", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "external" - }, - { - "name": "before_transfer_position", - "type": "function", - "inputs": [ - { - "name": "from_context", - "type": "vesu::data_model::Context" - }, - { - "name": "to_context", - "type": "vesu::data_model::Context" - }, - { - "name": "collateral", - "type": "vesu::data_model::UnsignedAmount" - }, - { - "name": "debt", - "type": "vesu::data_model::UnsignedAmount" - }, - { - "name": "data", - "type": "core::array::Span::" - }, - { - "name": "caller", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "(vesu::data_model::UnsignedAmount, vesu::data_model::UnsignedAmount)" - } - ], - "state_mutability": "external" - }, - { - "name": "after_transfer_position", - "type": "function", - "inputs": [ - { - "name": "from_context", - "type": "vesu::data_model::Context" - }, - { - "name": "to_context", - "type": "vesu::data_model::Context" - }, - { - "name": "collateral_delta", - "type": "core::integer::u256" - }, - { - "name": "collateral_shares_delta", - "type": "core::integer::u256" - }, - { - "name": "debt_delta", - "type": "core::integer::u256" - }, - { - "name": "nominal_debt_delta", - "type": "core::integer::u256" - }, - { - "name": "data", - "type": "core::array::Span::" - }, - { - "name": "caller", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "external" - }, - { - "name": "before_liquidate_position", - "type": "function", - "inputs": [ - { - "name": "context", - "type": "vesu::data_model::Context" - }, - { - "name": "data", - "type": "core::array::Span::" - }, - { - "name": "caller", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "(core::integer::u256, core::integer::u256, core::integer::u256)" - } - ], - "state_mutability": "external" - }, - { - "name": "after_liquidate_position", - "type": "function", - "inputs": [ - { - "name": "context", - "type": "vesu::data_model::Context" - }, - { - "name": "collateral_delta", - "type": "alexandria_math::i257::i257" - }, - { - "name": "collateral_shares_delta", - "type": "alexandria_math::i257::i257" - }, - { - "name": "debt_delta", - "type": "alexandria_math::i257::i257" - }, - { - "name": "nominal_debt_delta", - "type": "alexandria_math::i257::i257" - }, - { - "name": "bad_debt", - "type": "core::integer::u256" - }, - { - "name": "data", - "type": "core::array::Span::" - }, - { - "name": "caller", - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "outputs": [ - { - "type": "core::bool" - } - ], - "state_mutability": "external" - } - ] - }, - { - "name": "constructor", - "type": "constructor", - "inputs": [ - { - "name": "singleton", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "oracle_address", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "v_token_class_hash", - "type": "core::felt252" - } - ] - }, - { - "kind": "struct", - "name": "vesu::extension::components::position_hooks::position_hooks_component::SetLiquidationConfig", - "type": "event", - "members": [ - { - "kind": "data", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "data", - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "liquidation_config", - "type": "vesu::extension::components::position_hooks::LiquidationConfig" - } - ] - }, - { - "kind": "struct", - "name": "vesu::extension::components::position_hooks::position_hooks_component::SetShutdownConfig", - "type": "event", - "members": [ - { - "kind": "data", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "data", - "name": "shutdown_config", - "type": "vesu::extension::components::position_hooks::ShutdownConfig" - } - ] - }, - { - "kind": "struct", - "name": "vesu::extension::components::position_hooks::position_hooks_component::SetShutdownLTVConfig", - "type": "event", - "members": [ - { - "kind": "data", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "data", - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "shutdown_ltv_config", - "type": "vesu::data_model::LTVConfig" - } - ] - }, - { - "kind": "enum", - "name": "vesu::extension::components::position_hooks::position_hooks_component::Event", - "type": "event", - "variants": [ - { - "kind": "nested", - "name": "SetLiquidationConfig", - "type": "vesu::extension::components::position_hooks::position_hooks_component::SetLiquidationConfig" - }, - { - "kind": "nested", - "name": "SetShutdownConfig", - "type": "vesu::extension::components::position_hooks::position_hooks_component::SetShutdownConfig" - }, - { - "kind": "nested", - "name": "SetShutdownLTVConfig", - "type": "vesu::extension::components::position_hooks::position_hooks_component::SetShutdownLTVConfig" - } - ] - }, - { - "kind": "struct", - "name": "vesu::extension::components::interest_rate_model::interest_rate_model_component::SetInterestRateConfig", - "type": "event", - "members": [ - { - "kind": "data", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "data", - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "interest_rate_config", - "type": "vesu::extension::components::interest_rate_model::InterestRateConfig" - } - ] - }, - { - "kind": "enum", - "name": "vesu::extension::components::interest_rate_model::interest_rate_model_component::Event", - "type": "event", - "variants": [ - { - "kind": "nested", - "name": "SetInterestRateConfig", - "type": "vesu::extension::components::interest_rate_model::interest_rate_model_component::SetInterestRateConfig" - } - ] - }, - { - "kind": "struct", - "name": "vesu::extension::components::pragma_oracle::pragma_oracle_component::SetOracleConfig", - "type": "event", - "members": [ - { - "kind": "data", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "data", - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "oracle_config", - "type": "vesu::extension::components::pragma_oracle::OracleConfig" - } - ] - }, - { - "kind": "struct", - "name": "vesu::extension::components::pragma_oracle::pragma_oracle_component::SetOracleParameter", - "type": "event", - "members": [ - { - "kind": "data", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "data", - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "parameter", - "type": "core::felt252" - }, - { - "kind": "data", - "name": "value", - "type": "core::integer::u64" - } - ] - }, - { - "kind": "enum", - "name": "vesu::extension::components::pragma_oracle::pragma_oracle_component::Event", - "type": "event", - "variants": [ - { - "kind": "nested", - "name": "SetOracleConfig", - "type": "vesu::extension::components::pragma_oracle::pragma_oracle_component::SetOracleConfig" - }, - { - "kind": "nested", - "name": "SetOracleParameter", - "type": "vesu::extension::components::pragma_oracle::pragma_oracle_component::SetOracleParameter" - } - ] - }, - { - "kind": "enum", - "name": "vesu::map_list::map_list_component::Event", - "type": "event", - "variants": [] - }, - { - "kind": "struct", - "name": "vesu::extension::components::fee_model::fee_model_component::SetFeeConfig", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "key", - "name": "fee_config", - "type": "vesu::extension::components::fee_model::FeeConfig" - } - ] - }, - { - "kind": "struct", - "name": "vesu::extension::components::fee_model::fee_model_component::ClaimFees", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "data", - "name": "collateral_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "debt_asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "recipient", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "data", - "name": "amount", - "type": "core::integer::u256" - } - ] - }, - { - "kind": "enum", - "name": "vesu::extension::components::fee_model::fee_model_component::Event", - "type": "event", - "variants": [ - { - "kind": "nested", - "name": "SetFeeConfig", - "type": "vesu::extension::components::fee_model::fee_model_component::SetFeeConfig" - }, - { - "kind": "nested", - "name": "ClaimFees", - "type": "vesu::extension::components::fee_model::fee_model_component::ClaimFees" - } - ] - }, - { - "kind": "enum", - "name": "vesu::extension::components::tokenization::tokenization_component::Event", - "type": "event", - "variants": [] - }, - { - "kind": "struct", - "name": "vesu::extension::default_extension::DefaultExtension::SetAssetParameter", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "key", - "name": "asset", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "kind": "key", - "name": "parameter", - "type": "core::felt252" - }, - { - "kind": "data", - "name": "value", - "type": "core::integer::u256" - } - ] - }, - { - "kind": "struct", - "name": "vesu::extension::default_extension::DefaultExtension::SetPoolOwner", - "type": "event", - "members": [ - { - "kind": "key", - "name": "pool_id", - "type": "core::felt252" - }, - { - "kind": "key", - "name": "owner", - "type": "core::starknet::contract_address::ContractAddress" - } - ] - }, - { - "kind": "enum", - "name": "vesu::extension::default_extension::DefaultExtension::Event", - "type": "event", - "variants": [ - { - "kind": "nested", - "name": "PositionHooksEvents", - "type": "vesu::extension::components::position_hooks::position_hooks_component::Event" - }, - { - "kind": "nested", - "name": "InterestRateModelEvents", - "type": "vesu::extension::components::interest_rate_model::interest_rate_model_component::Event" - }, - { - "kind": "nested", - "name": "PragmaOracleEvents", - "type": "vesu::extension::components::pragma_oracle::pragma_oracle_component::Event" - }, - { - "kind": "nested", - "name": "MapListEvents", - "type": "vesu::map_list::map_list_component::Event" - }, - { - "kind": "nested", - "name": "FeeModelEvents", - "type": "vesu::extension::components::fee_model::fee_model_component::Event" - }, - { - "kind": "nested", - "name": "TokenizationEvents", - "type": "vesu::extension::components::tokenization::tokenization_component::Event" - }, - { - "kind": "nested", - "name": "SetAssetParameter", - "type": "vesu::extension::default_extension::DefaultExtension::SetAssetParameter" - }, - { - "kind": "nested", - "name": "SetPoolOwner", - "type": "vesu::extension::default_extension::DefaultExtension::SetPoolOwner" - } - ] - } -] \ No newline at end of file From bd2a71276a5338faa73e8a92a0539851379e6756 Mon Sep 17 00:00:00 2001 From: Ugo-X Date: Sun, 1 Sep 2024 09:41:59 +0100 Subject: [PATCH 4/6] updated vesu name in list --- src/store/pools.ts | 6 +++--- src/store/vesu.store.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/store/pools.ts b/src/store/pools.ts index df67605b..a5b8bfe4 100755 --- a/src/store/pools.ts +++ b/src/store/pools.ts @@ -15,7 +15,7 @@ import StarkDefiAtoms, { starkDefi } from './starkdefi.store'; import TenkSwapAtoms, { tenkswap } from './tenkswap.store'; import ZkLendAtoms, { zkLend } from './zklend.store'; import CarmineAtoms, { carmine } from './carmine.store'; -import VesuAtoms, { Vesu } from './vesu.store'; +import VesuAtoms, { Vesu, vesu } from './vesu.store'; export enum Category { Stable = 'Stable Pools', @@ -77,8 +77,8 @@ export const PROTOCOLS = [ atoms: EkuboAtoms, }, { - name: Vesu.name, - class: Vesu, + name: vesu.name, + class: vesu, atoms: VesuAtoms, }, { diff --git a/src/store/vesu.store.ts b/src/store/vesu.store.ts index d16a3f6f..041d2800 100644 --- a/src/store/vesu.store.ts +++ b/src/store/vesu.store.ts @@ -142,7 +142,7 @@ fetchAndUpdatePoolsData(); console.log(poolsData, 'updated-pool-data'); export class Vesu extends Jediswap { - name = 'Vesu.xyz'; + name = 'Vesu'; link = 'https://www.vesu.xyz/markets'; logo = 'https://github.com/vesuxyz/assets/blob/main/logo/logo_hi-res_light-mode.png'; From c7badbce9ec15cc78c8deb01c8b2b8dd7a9992ba Mon Sep 17 00:00:00 2001 From: Ugo-X Date: Sun, 1 Sep 2024 09:45:07 +0100 Subject: [PATCH 5/6] updated vesu name in list --- src/store/pools.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/pools.ts b/src/store/pools.ts index a5b8bfe4..cc9ba9bf 100755 --- a/src/store/pools.ts +++ b/src/store/pools.ts @@ -15,7 +15,7 @@ import StarkDefiAtoms, { starkDefi } from './starkdefi.store'; import TenkSwapAtoms, { tenkswap } from './tenkswap.store'; import ZkLendAtoms, { zkLend } from './zklend.store'; import CarmineAtoms, { carmine } from './carmine.store'; -import VesuAtoms, { Vesu, vesu } from './vesu.store'; +import VesuAtoms, { vesu } from './vesu.store'; export enum Category { Stable = 'Stable Pools', From 395f306b049cd4178cfffab53fe878778e94f467 Mon Sep 17 00:00:00 2001 From: Ugo-X Date: Wed, 4 Sep 2024 19:13:58 +0100 Subject: [PATCH 6/6] fixed the comments in the review --- src/store/pools.ts | 20 ++++++++++ src/store/vesu.store.ts | 84 ++++++++++++++++++++++++----------------- 2 files changed, 69 insertions(+), 35 deletions(-) diff --git a/src/store/pools.ts b/src/store/pools.ts index cc9ba9bf..bb1f2b67 100755 --- a/src/store/pools.ts +++ b/src/store/pools.ts @@ -182,6 +182,26 @@ export const StrkIncentivesQueryKeyAtom = atom([ 'isNostraDegen', ]); +export const VesuIncentivesAtom = atomWithQuery((get) => ({ + queryKey: get(VesuIncentivesQueryKeyAtom), + queryFn: async ({ queryKey }) => { + const res = await fetch(CONSTANTS.LENDING_INCENTIVES_URL); + let data = await res.text(); + data = data.replaceAll('NaN', '0'); // Replace any NaN values with 0 + const parsedData = JSON.parse(data); // Parse the cleaned data into JSON + + // Extract and return the Vesu object directly + if (parsedData && parsedData['Vesu']) { + return parsedData['Vesu']; + } + + // Return an empty object if 'Vesu' is not found + return {}; + }, +})); + +export const VesuIncentivesQueryKeyAtom = atom(['strk_incentives', 'isVesu']); + export const StrkLendingIncentivesAtom = atomWithQuery((get) => ({ queryKey: ['strk_lending_incentives'], queryFn: async ({ queryKey }) => { diff --git a/src/store/vesu.store.ts b/src/store/vesu.store.ts index 041d2800..dc0dfd01 100644 --- a/src/store/vesu.store.ts +++ b/src/store/vesu.store.ts @@ -4,7 +4,13 @@ import CONSTANTS, { TokenName } from '@/constants'; import { atom } from 'jotai'; import { Contract, RpcProvider } from 'starknet'; import { Jediswap } from './jedi.store'; -import { Category, PoolInfo, PoolType, ProtocolAtoms } from './pools'; +import { + Category, + PoolInfo, + PoolType, + ProtocolAtoms, + VesuIncentivesAtom, +} from './pools'; // Initialize the provider const provider = new RpcProvider({ nodeUrl: process.env.NEXT_PUBLIC_RPC_URL }); @@ -12,7 +18,8 @@ const provider = new RpcProvider({ nodeUrl: process.env.NEXT_PUBLIC_RPC_URL }); // Define the ABIs for the contracts const VesuAbi = vesuAbi; const VesuInterestRateAbi = vesuInterestRateAbi; - +const ContractAddress = + '0x02545b2e5d519fc230e9cd781046d3a64e092114f07e44771e0d719d148725ef'; // Utility function to convert a string to BigInt and then to hex const toBigIntHex = (id: string): string => { const bigIntValue = BigInt(id); @@ -21,11 +28,7 @@ const toBigIntHex = (id: string): string => { // Function to get Utilization const getUtilisation = async (poolId: string, tokenAddress: string) => { - const contract = new Contract( - VesuAbi, - '0x02545b2e5d519fc230e9cd781046d3a64e092114f07e44771e0d719d148725ef', - provider, - ); + const contract = new Contract(VesuAbi, ContractAddress, provider); const poolidHex = toBigIntHex(poolId); const res: any = await contract.call('utilization_unsafe', [ poolidHex, @@ -36,11 +39,7 @@ const getUtilisation = async (poolId: string, tokenAddress: string) => { // Function to get Asset Info const getAssetInfo = async (poolId: string, tokenAddress: string) => { - const contract = new Contract( - VesuAbi, - '0x02545b2e5d519fc230e9cd781046d3a64e092114f07e44771e0d719d148725ef', - provider, - ); + const contract = new Contract(VesuAbi, ContractAddress, provider); const poolidHex = toBigIntHex(poolId); const res: any = await contract.call('asset_config_unsafe', [ @@ -52,11 +51,7 @@ const getAssetInfo = async (poolId: string, tokenAddress: string) => { // Function to get Base APY const getBaseApy = async (poolId: string, tokenAddress: string) => { - const contract = new Contract( - VesuInterestRateAbi, - '0x002334189e831d804d4a11d3f71d4a982ec82614ac12ed2e9ca2f8da4e6374fa', - provider, - ); + const contract = new Contract(VesuInterestRateAbi, ContractAddress, provider); const utilization = await getUtilisation(poolId, tokenAddress); const assetInfo = await getAssetInfo(poolId, tokenAddress); @@ -76,7 +71,6 @@ const getBaseApy = async (poolId: string, tokenAddress: string) => { return apy; }; -// The Vesu Pool data is hardcoded here as there is no API and there's a lot of calculations made into finding the APY values for each of their pools. const poolsData = [ { id: 'ETH', @@ -86,9 +80,9 @@ const poolsData = [ '2198503327643286920898110335698706244522220458610657370981979460625005526824', tokenAddress: '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7', - rewardApr: '0.09', - baseApr: '0', - tvl: '1000000', + rewardApr: '', + baseApr: '', + tvl: '', }, { id: 'STRK', @@ -98,9 +92,9 @@ const poolsData = [ '2198503327643286920898110335698706244522220458610657370981979460625005526824', tokenAddress: '0x4718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d', - rewardApr: '0.13', - baseApr: '0', - tvl: '2000000', + rewardApr: '', + baseApr: '', + tvl: '', }, { id: 'USDC', @@ -110,9 +104,9 @@ const poolsData = [ '2198503327643286920898110335698706244522220458610657370981979460625005526824', tokenAddress: '0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8', - rewardApr: '0.10', - baseApr: '0', - tvl: '2000000', + rewardApr: '', + baseApr: '', + tvl: '', }, { id: 'USDT', @@ -122,9 +116,9 @@ const poolsData = [ '2198503327643286920898110335698706244522220458610657370981979460625005526824', tokenAddress: '0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8', - rewardApr: '0.10', - baseApr: '0', - tvl: '2000000', + rewardApr: '', + baseApr: '', + tvl: '', }, ]; @@ -148,16 +142,32 @@ export class Vesu extends Jediswap { 'https://github.com/vesuxyz/assets/blob/main/logo/logo_hi-res_light-mode.png'; incentiveDataKey = 'isVesu'; - _computePoolsInfo() { + _computePoolsInfo(data: any) { try { + const myData = data; + console.log(myData, 'API response data'); + const pools: PoolInfo[] = []; + + poolsData.forEach((poolData) => { + if (poolData.isVesu && myData[poolData.tokenA]) { + const latestData = + myData[poolData.tokenA][myData[poolData.tokenA].length - 1]; + + const tvl = latestData.supply_usd; + const rewardApr = latestData.strk_grant_apr_ts; + + poolData.tvl = tvl.toString(); + poolData.rewardApr = rewardApr; + } + }); + poolsData.forEach((poolData) => { if (poolData.isVesu) { const category = Category.Stable; const tokens: TokenName[] = [poolData.tokenA] as TokenName[]; const logo1 = CONSTANTS.LOGOS[tokens[0]]; - // Use the precomputed baseApr const baseApr = parseFloat(poolData.baseApr); const rewardApr = parseFloat(poolData.rewardApr); @@ -186,7 +196,7 @@ export class Vesu extends Jediswap { }, ], category, - type: PoolType.DEXV2, + type: PoolType.Lending, lending: { collateralFactor: 0, }, @@ -198,6 +208,7 @@ export class Vesu extends Jediswap { pools.push(poolInfo); } }); + console.log(pools); return pools; } catch (err) { @@ -210,8 +221,11 @@ export class Vesu extends Jediswap { export const vesu = new Vesu(); const VesuAtoms: ProtocolAtoms = { - pools: atom(() => { - return vesu._computePoolsInfo(); + pools: atom((get) => { + const poolsInfo = get(VesuIncentivesAtom); + const empty: PoolInfo[] = []; + if (poolsInfo.data) return vesu._computePoolsInfo(poolsInfo.data); + return empty; }), };