RPC
If you want to read data from specific object, it’s best to use RPC, or block explorer.
For example
If you want to read ReserveData object.
First locate the object id from the contract address section above.
Then search in block explorer: https://suiexplorer.com/object/0xab644b5fd11aa11e930d1c7bc903ef609a9feaf9ffe1b23532ad8441854fbfaf
Or you can use RPC call:
send:
{
"jsonrpc": "2.0",
"id": 1,
"method": "sui_getObject",
"params": [
"0xab644b5fd11aa11e930d1c7bc903ef609a9feaf9ffe1b23532ad8441854fbfaf",
{
"showType": true,
"showOwner": true,
"showPreviousTransaction": true,
"showDisplay": false,
"showContent": true,
"showBcs": false,
"showStorageRebate": true
}
]
}
return:
{
"type": "0xd899cf7d2b5db716bd2cf55599fb0d5ee38a3061e7b6bb6eebf73fa5bc4c81ca::storage::ReserveData",
"fields": {
"borrow_balance": {
"type": "0xd899cf7d2b5db716bd2cf55599fb0d5ee38a3061e7b6bb6eebf73fa5bc4c81ca::storage::TokenBalance",
"fields": {
"total_supply": "3094503595272548",
"user_state": {
"type": "0x2::table::Table<address, u256>",
"fields": {
"id": {
"id": "0xe7ff0daa9d090727210abe6a8b6c0c5cd483f3692a10610386e4dc9c57871ba7"
},
"size": "27611"
}
}
}
},
"borrow_cap_ceiling": "900000000000000000000000000",
"borrow_rate_factors": {
"type": "0xd899cf7d2b5db716bd2cf55599fb0d5ee38a3061e7b6bb6eebf73fa5bc4c81ca::storage::BorrowRateFactors",
"fields": {
"base_rate": "0",
"jump_rate_multiplier": "3000000000000000000000000000",
"multiplier": "80000000000000000000000000",
"optimal_utilization": "800000000000000000000000000",
"reserve_factor": "100000000000000000000000000"
}
},
"coin_type": "0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
"current_borrow_index": "1001871331192120137533827403",
"current_borrow_rate": "29077024305850157392905536",
"current_supply_index": "1000597811335627575419632960",
"current_supply_rate": "9511575102933759308012649",
"id": 0,
"is_isolated": false,
"last_update_timestamp": "1693302442763",
"liquidation_factors": {
"type": "0xd899cf7d2b5db716bd2cf55599fb0d5ee38a3061e7b6bb6eebf73fa5bc4c81ca::storage::LiquidationFactors",
"fields": {
"bonus": "100000000000000000000000000",
"ratio": "350000000000000000000000000",
"threshold": "700000000000000000000000000"
}
},
"ltv": "650000000000000000000000000",
"oracle_id": 0,
"reserve_field_a": "0",
"reserve_field_b": "0",
"reserve_field_c": "0",
"supply_balance": {
"type": "0xd899cf7d2b5db716bd2cf55599fb0d5ee38a3061e7b6bb6eebf73fa5bc4c81ca::storage::TokenBalance",
"fields": {
"total_supply": "8524784709581295",
"user_state": {
"type": "0x2::table::Table<address, u256>",
"fields": {
"id": {
"id": "0x589c83af4b035a3bc64c40d9011397b539b97ea47edf7be8f33d643606bf96f8"
},
"size": "641554"
}
}
}
},
"supply_cap_ceiling": "12000000000000000000000000000000000000000000",
"treasury_balance": "270738370380",
"treasury_factor": "100000000000000000000000000"
}
}
SuiVision-Integration
How to get the tvl and apy of each pool
API: https://api-defi.naviprotocol.io/getIndexAssetData
{
"0": {
"coin_type": "0x2::sui::SUI",
"total_supply": "13630285.90747310",
"total_borrow": "6636475.33967934",
"price": "0.60731567",
"supply_rate": "2.26595035", //supply apy
"borrow_rate": "5.74092744",//borrow apy
"boosted": "17.05906733",//supply boosted APR
"borrow_reward_apy": "12.05906733",//borrow_reward_apy
"pool": "SUI-Sui",
"symbol": "SUI",
"rewardTokens": ["0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
},
"1": {
"coin_type": "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN",
"total_supply": "17185368.73534733",
"total_borrow": "5307241.43227983",
"price": "0.99987300",
"supply_rate": "1.00639574",
"borrow_rate": "4.01277110",
"boosted": "22.07013167",
"borrow_reward_apy": "12.05906733",//borrow_reward_apy
"pool": "USDC-Sui",
"symbol": "USDC",
"rewardTokens": ["0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
},
"2": {
"coin_type": "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN",
"total_supply": "3742570.49005791",
"total_borrow": "1945015.81017184",
"price": "1.00058800",
"supply_rate": "6.98196648",
"borrow_rate": "14.74625592",
"boosted": "9.06571174",
"borrow_reward_apy": "12.05906733",//borrow_reward_apy
"pool": "USDT-Sui",
"symbol": "USDT",
"rewardTokens": ["0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
},
"3": {
"coin_type": "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN",
"total_supply": "5.38344809",
"total_borrow": "3.51034722",
"price": "2059.43377825",
"supply_rate": "2.93980940",
"borrow_rate": "5.62165021",
"boosted": "0.0",
"borrow_reward_apy": "12.05906733",//borrow_reward_apy
"pool": "WETH-Sui",
"symbol": "WETH",
"rewardTokens": null
}
}
Last updated