Compare commits

...

3 Commits

Author SHA1 Message Date
Bob van der Helm
7ebd35fbfd
update hc wasm files 2023-11-23 15:12:06 +01:00
Bob van der Helm
4c88cfd99f
add logging 2023-11-23 11:05:12 +01:00
Bob van der Helm
373b147997
enable hls 2023-11-23 10:39:00 +01:00
6 changed files with 37 additions and 4 deletions

View File

@ -7,12 +7,15 @@ import { resolveHLSStrategies } from 'utils/resolvers'
export default async function getHLSStakingAssets() {
const stakingAssetDenoms = getStakingAssets().map((asset) => asset.denom)
console.log('stakingAssetDenoms', stakingAssetDenoms)
const assetParams = await getAssetParams()
console.log('assetParams', assetParams)
const HLSAssets = assetParams
.filter((asset) => stakingAssetDenoms.includes(asset.denom))
.filter((asset) => asset.credit_manager.hls)
console.log('HLSAssets', HLSAssets)
const strategies = resolveHLSStrategies('coin', HLSAssets)
console.log('strategies', strategies)
const client = await getParamsQueryClient()
const depositCaps$ = strategies.map((strategy) =>
client.totalDeposit({ denom: strategy.denoms.deposit }),

View File

@ -20,5 +20,5 @@ export const DEFAULT_PORTFOLIO_STATS = [
{ title: null, sub: 'Account Leverage' },
]
export const ENABLE_HLS = false
export const ENABLE_HLS = true
export const ENABLE_PERPS = false

View File

@ -37,6 +37,12 @@ export function max_swap_estimate_js(
kind: SwapKind,
slippage: Slippage,
): string
/**
* @param {HealthComputer} c
* @param {string} denom
* @returns {string}
*/
export function liquidation_price_js(c: HealthComputer, denom: string): string
export interface HealthComputer {
kind: AccountKind
positions: Positions
@ -82,9 +88,9 @@ export interface InitOutput {
g: number,
h: number,
) => void
readonly liquidation_price_js: (a: number, b: number, c: number, d: number) => void
readonly allocate: (a: number) => number
readonly deallocate: (a: number) => void
readonly requires_stargate: () => void
readonly requires_iterator: () => void
readonly interface_version_8: () => void
readonly __wbindgen_malloc: (a: number, b: number) => number

View File

@ -230,6 +230,30 @@ export function max_swap_estimate_js(c, from_denom, to_denom, kind, slippage) {
}
}
/**
* @param {HealthComputer} c
* @param {string} denom
* @returns {string}
*/
export function liquidation_price_js(c, denom) {
let deferred2_0
let deferred2_1
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16)
const ptr0 = passStringToWasm0(denom, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc)
const len0 = WASM_VECTOR_LEN
wasm.liquidation_price_js(retptr, addHeapObject(c), ptr0, len0)
var r0 = getInt32Memory0()[retptr / 4 + 0]
var r1 = getInt32Memory0()[retptr / 4 + 1]
deferred2_0 = r0
deferred2_1 = r1
return getStringFromWasm0(r0, r1)
} finally {
wasm.__wbindgen_add_to_stack_pointer(16)
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1)
}
}
function handleError(f, args) {
try {
return f.apply(this, args)

View File

@ -14,9 +14,9 @@ export function max_swap_estimate_js(
g: number,
h: number,
): void
export function liquidation_price_js(a: number, b: number, c: number, d: number): void
export function allocate(a: number): number
export function deallocate(a: number): void
export function requires_stargate(): void
export function requires_iterator(): void
export function interface_version_8(): void
export function __wbindgen_malloc(a: number, b: number): number