@defisaver/positions-sdk 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/cjs/aaveV3/index.d.ts +1 -1
  2. package/cjs/aaveV3/index.js +2 -3
  3. package/cjs/compoundV3/index.d.ts +1 -1
  4. package/cjs/compoundV3/index.js +2 -3
  5. package/cjs/config/contracts.d.ts +184 -72
  6. package/cjs/config/contracts.js +16 -0
  7. package/cjs/helpers/aaveHelpers/index.js +5 -0
  8. package/cjs/liquity/index.d.ts +1 -0
  9. package/cjs/liquity/index.js +15 -2
  10. package/cjs/markets/curveUsd/index.d.ts +2 -0
  11. package/cjs/markets/curveUsd/index.js +14 -1
  12. package/cjs/morphoAaveV3/index.d.ts +1 -1
  13. package/cjs/morphoAaveV3/index.js +2 -3
  14. package/cjs/types/aave.d.ts +5 -0
  15. package/cjs/types/contracts/generated/CrvUSDsfrxETHAmm.d.ts +139 -0
  16. package/cjs/types/contracts/generated/CrvUSDsfrxETHAmm.js +5 -0
  17. package/cjs/types/contracts/generated/CrvUSDsfrxETHController.d.ts +205 -0
  18. package/cjs/types/contracts/generated/CrvUSDsfrxETHController.js +5 -0
  19. package/cjs/types/contracts/generated/index.d.ts +2 -0
  20. package/cjs/types/curveUsd.d.ts +2 -1
  21. package/cjs/types/curveUsd.js +1 -0
  22. package/cjs/types/liquity.d.ts +1 -0
  23. package/esm/aaveV3/index.d.ts +1 -1
  24. package/esm/aaveV3/index.js +2 -3
  25. package/esm/compoundV3/index.d.ts +1 -1
  26. package/esm/compoundV3/index.js +2 -3
  27. package/esm/config/contracts.d.ts +184 -72
  28. package/esm/config/contracts.js +16 -0
  29. package/esm/helpers/aaveHelpers/index.js +5 -0
  30. package/esm/liquity/index.d.ts +1 -0
  31. package/esm/liquity/index.js +13 -1
  32. package/esm/markets/curveUsd/index.d.ts +2 -0
  33. package/esm/markets/curveUsd/index.js +12 -0
  34. package/esm/morphoAaveV3/index.d.ts +1 -1
  35. package/esm/morphoAaveV3/index.js +2 -3
  36. package/esm/types/aave.d.ts +5 -0
  37. package/esm/types/contracts/generated/CrvUSDsfrxETHAmm.d.ts +139 -0
  38. package/esm/types/contracts/generated/CrvUSDsfrxETHAmm.js +4 -0
  39. package/esm/types/contracts/generated/CrvUSDsfrxETHController.d.ts +205 -0
  40. package/esm/types/contracts/generated/CrvUSDsfrxETHController.js +4 -0
  41. package/esm/types/contracts/generated/index.d.ts +2 -0
  42. package/esm/types/curveUsd.d.ts +2 -1
  43. package/esm/types/curveUsd.js +1 -0
  44. package/esm/types/liquity.d.ts +1 -0
  45. package/package.json +1 -1
  46. package/src/aaveV3/index.ts +2 -4
  47. package/src/compoundV3/index.ts +1 -4
  48. package/src/helpers/aaveHelpers/index.ts +7 -0
  49. package/src/liquity/index.ts +14 -1
  50. package/src/morphoAaveV3/index.ts +1 -4
  51. package/src/types/aave.ts +5 -0
  52. package/src/types/contracts/generated/CrvUSDsfrxETHAmm.ts +286 -0
  53. package/src/types/contracts/generated/CrvUSDsfrxETHController.ts +403 -0
  54. package/src/types/contracts/generated/index.ts +2 -0
  55. package/src/types/liquity.ts +1 -0
@@ -456,6 +456,14 @@ module.exports = {
456
456
  }
457
457
  }
458
458
  },
459
+ "crvUSDsfrxETHController": {
460
+ "abi": [{ "name": "UserState", "inputs": [{ "name": "user", "type": "address", "indexed": true }, { "name": "collateral", "type": "uint256", "indexed": false }, { "name": "debt", "type": "uint256", "indexed": false }, { "name": "n1", "type": "int256", "indexed": false }, { "name": "n2", "type": "int256", "indexed": false }, { "name": "liquidation_discount", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "Borrow", "inputs": [{ "name": "user", "type": "address", "indexed": true }, { "name": "collateral_increase", "type": "uint256", "indexed": false }, { "name": "loan_increase", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "Repay", "inputs": [{ "name": "user", "type": "address", "indexed": true }, { "name": "collateral_decrease", "type": "uint256", "indexed": false }, { "name": "loan_decrease", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "RemoveCollateral", "inputs": [{ "name": "user", "type": "address", "indexed": true }, { "name": "collateral_decrease", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "Liquidate", "inputs": [{ "name": "liquidator", "type": "address", "indexed": true }, { "name": "user", "type": "address", "indexed": true }, { "name": "collateral_received", "type": "uint256", "indexed": false }, { "name": "stablecoin_received", "type": "uint256", "indexed": false }, { "name": "debt", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "SetMonetaryPolicy", "inputs": [{ "name": "monetary_policy", "type": "address", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "SetBorrowingDiscounts", "inputs": [{ "name": "loan_discount", "type": "uint256", "indexed": false }, { "name": "liquidation_discount", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "CollectFees", "inputs": [{ "name": "amount", "type": "uint256", "indexed": false }, { "name": "new_supply", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "stateMutability": "nonpayable", "type": "constructor", "inputs": [{ "name": "collateral_token", "type": "address" }, { "name": "monetary_policy", "type": "address" }, { "name": "loan_discount", "type": "uint256" }, { "name": "liquidation_discount", "type": "uint256" }, { "name": "amm", "type": "address" }], "outputs": [] }, { "stateMutability": "payable", "type": "fallback" }, { "stateMutability": "view", "type": "function", "name": "factory", "inputs": [], "outputs": [{ "name": "", "type": "address" }] }, { "stateMutability": "view", "type": "function", "name": "amm", "inputs": [], "outputs": [{ "name": "", "type": "address" }] }, { "stateMutability": "view", "type": "function", "name": "collateral_token", "inputs": [], "outputs": [{ "name": "", "type": "address" }] }, { "stateMutability": "view", "type": "function", "name": "debt", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "loan_exists", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "bool" }] }, { "stateMutability": "view", "type": "function", "name": "total_debt", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "max_borrowable", "inputs": [{ "name": "collateral", "type": "uint256" }, { "name": "N", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "max_borrowable", "inputs": [{ "name": "collateral", "type": "uint256" }, { "name": "N", "type": "uint256" }, { "name": "current_debt", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "min_collateral", "inputs": [{ "name": "debt", "type": "uint256" }, { "name": "N", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "calculate_debt_n1", "inputs": [{ "name": "collateral", "type": "uint256" }, { "name": "debt", "type": "uint256" }, { "name": "N", "type": "uint256" }], "outputs": [{ "name": "", "type": "int256" }] }, { "stateMutability": "payable", "type": "function", "name": "create_loan", "inputs": [{ "name": "collateral", "type": "uint256" }, { "name": "debt", "type": "uint256" }, { "name": "N", "type": "uint256" }], "outputs": [] }, { "stateMutability": "payable", "type": "function", "name": "create_loan_extended", "inputs": [{ "name": "collateral", "type": "uint256" }, { "name": "debt", "type": "uint256" }, { "name": "N", "type": "uint256" }, { "name": "callbacker", "type": "address" }, { "name": "callback_args", "type": "uint256[]" }], "outputs": [] }, { "stateMutability": "payable", "type": "function", "name": "add_collateral", "inputs": [{ "name": "collateral", "type": "uint256" }], "outputs": [] }, { "stateMutability": "payable", "type": "function", "name": "add_collateral", "inputs": [{ "name": "collateral", "type": "uint256" }, { "name": "_for", "type": "address" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "remove_collateral", "inputs": [{ "name": "collateral", "type": "uint256" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "remove_collateral", "inputs": [{ "name": "collateral", "type": "uint256" }, { "name": "use_eth", "type": "bool" }], "outputs": [] }, { "stateMutability": "payable", "type": "function", "name": "borrow_more", "inputs": [{ "name": "collateral", "type": "uint256" }, { "name": "debt", "type": "uint256" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "repay", "inputs": [{ "name": "_d_debt", "type": "uint256" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "repay", "inputs": [{ "name": "_d_debt", "type": "uint256" }, { "name": "_for", "type": "address" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "repay", "inputs": [{ "name": "_d_debt", "type": "uint256" }, { "name": "_for", "type": "address" }, { "name": "max_active_band", "type": "int256" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "repay", "inputs": [{ "name": "_d_debt", "type": "uint256" }, { "name": "_for", "type": "address" }, { "name": "max_active_band", "type": "int256" }, { "name": "use_eth", "type": "bool" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "repay_extended", "inputs": [{ "name": "callbacker", "type": "address" }, { "name": "callback_args", "type": "uint256[]" }], "outputs": [] }, { "stateMutability": "view", "type": "function", "name": "health_calculator", "inputs": [{ "name": "user", "type": "address" }, { "name": "d_collateral", "type": "int256" }, { "name": "d_debt", "type": "int256" }, { "name": "full", "type": "bool" }], "outputs": [{ "name": "", "type": "int256" }] }, { "stateMutability": "view", "type": "function", "name": "health_calculator", "inputs": [{ "name": "user", "type": "address" }, { "name": "d_collateral", "type": "int256" }, { "name": "d_debt", "type": "int256" }, { "name": "full", "type": "bool" }, { "name": "N", "type": "uint256" }], "outputs": [{ "name": "", "type": "int256" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "liquidate", "inputs": [{ "name": "user", "type": "address" }, { "name": "min_x", "type": "uint256" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "liquidate", "inputs": [{ "name": "user", "type": "address" }, { "name": "min_x", "type": "uint256" }, { "name": "use_eth", "type": "bool" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "liquidate_extended", "inputs": [{ "name": "user", "type": "address" }, { "name": "min_x", "type": "uint256" }, { "name": "frac", "type": "uint256" }, { "name": "use_eth", "type": "bool" }, { "name": "callbacker", "type": "address" }, { "name": "callback_args", "type": "uint256[]" }], "outputs": [] }, { "stateMutability": "view", "type": "function", "name": "tokens_to_liquidate", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "tokens_to_liquidate", "inputs": [{ "name": "user", "type": "address" }, { "name": "frac", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "health", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "int256" }] }, { "stateMutability": "view", "type": "function", "name": "health", "inputs": [{ "name": "user", "type": "address" }, { "name": "full", "type": "bool" }], "outputs": [{ "name": "", "type": "int256" }] }, { "stateMutability": "view", "type": "function", "name": "users_to_liquidate", "inputs": [], "outputs": [{ "name": "", "type": "tuple[]", "components": [{ "name": "user", "type": "address" }, { "name": "x", "type": "uint256" }, { "name": "y", "type": "uint256" }, { "name": "debt", "type": "uint256" }, { "name": "health", "type": "int256" }] }] }, { "stateMutability": "view", "type": "function", "name": "users_to_liquidate", "inputs": [{ "name": "_from", "type": "uint256" }], "outputs": [{ "name": "", "type": "tuple[]", "components": [{ "name": "user", "type": "address" }, { "name": "x", "type": "uint256" }, { "name": "y", "type": "uint256" }, { "name": "debt", "type": "uint256" }, { "name": "health", "type": "int256" }] }] }, { "stateMutability": "view", "type": "function", "name": "users_to_liquidate", "inputs": [{ "name": "_from", "type": "uint256" }, { "name": "_limit", "type": "uint256" }], "outputs": [{ "name": "", "type": "tuple[]", "components": [{ "name": "user", "type": "address" }, { "name": "x", "type": "uint256" }, { "name": "y", "type": "uint256" }, { "name": "debt", "type": "uint256" }, { "name": "health", "type": "int256" }] }] }, { "stateMutability": "view", "type": "function", "name": "amm_price", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "user_prices", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "uint256[2]" }] }, { "stateMutability": "view", "type": "function", "name": "user_state", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "uint256[4]" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "set_amm_fee", "inputs": [{ "name": "fee", "type": "uint256" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "set_amm_admin_fee", "inputs": [{ "name": "fee", "type": "uint256" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "set_monetary_policy", "inputs": [{ "name": "monetary_policy", "type": "address" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "set_borrowing_discounts", "inputs": [{ "name": "loan_discount", "type": "uint256" }, { "name": "liquidation_discount", "type": "uint256" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "set_callback", "inputs": [{ "name": "cb", "type": "address" }], "outputs": [] }, { "stateMutability": "view", "type": "function", "name": "admin_fees", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "collect_fees", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "liquidation_discounts", "inputs": [{ "name": "arg0", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "loans", "inputs": [{ "name": "arg0", "type": "uint256" }], "outputs": [{ "name": "", "type": "address" }] }, { "stateMutability": "view", "type": "function", "name": "loan_ix", "inputs": [{ "name": "arg0", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "n_loans", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "minted", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "redeemed", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "monetary_policy", "inputs": [], "outputs": [{ "name": "", "type": "address" }] }, { "stateMutability": "view", "type": "function", "name": "liquidation_discount", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "loan_discount", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }],
461
+ "networks": {
462
+ "1": {
463
+ "address": "0xEC0820EfafC41D8943EE8dE495fC9Ba8495B15cf"
464
+ }
465
+ }
466
+ },
459
467
  "crvUSDwstETHAmm": {
460
468
  "abi": [{ "name": "TokenExchange", "inputs": [{ "name": "buyer", "type": "address", "indexed": true }, { "name": "sold_id", "type": "uint256", "indexed": false }, { "name": "tokens_sold", "type": "uint256", "indexed": false }, { "name": "bought_id", "type": "uint256", "indexed": false }, { "name": "tokens_bought", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "Deposit", "inputs": [{ "name": "provider", "type": "address", "indexed": true }, { "name": "amount", "type": "uint256", "indexed": false }, { "name": "n1", "type": "int256", "indexed": false }, { "name": "n2", "type": "int256", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "Withdraw", "inputs": [{ "name": "provider", "type": "address", "indexed": true }, { "name": "amount_borrowed", "type": "uint256", "indexed": false }, { "name": "amount_collateral", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "SetRate", "inputs": [{ "name": "rate", "type": "uint256", "indexed": false }, { "name": "rate_mul", "type": "uint256", "indexed": false }, { "name": "time", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "SetFee", "inputs": [{ "name": "fee", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "SetAdminFee", "inputs": [{ "name": "fee", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "stateMutability": "nonpayable", "type": "constructor", "inputs": [{ "name": "_borrowed_token", "type": "address" }, { "name": "_borrowed_precision", "type": "uint256" }, { "name": "_collateral_token", "type": "address" }, { "name": "_collateral_precision", "type": "uint256" }, { "name": "_A", "type": "uint256" }, { "name": "_sqrt_band_ratio", "type": "uint256" }, { "name": "_log_A_ratio", "type": "int256" }, { "name": "_base_price", "type": "uint256" }, { "name": "fee", "type": "uint256" }, { "name": "admin_fee", "type": "uint256" }, { "name": "_price_oracle_contract", "type": "address" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "set_admin", "inputs": [{ "name": "_admin", "type": "address" }], "outputs": [] }, { "stateMutability": "pure", "type": "function", "name": "coins", "inputs": [{ "name": "i", "type": "uint256" }], "outputs": [{ "name": "", "type": "address" }] }, { "stateMutability": "view", "type": "function", "name": "price_oracle", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "dynamic_fee", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "get_rate_mul", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "get_base_price", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "p_current_up", "inputs": [{ "name": "n", "type": "int256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "p_current_down", "inputs": [{ "name": "n", "type": "int256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "p_oracle_up", "inputs": [{ "name": "n", "type": "int256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "p_oracle_down", "inputs": [{ "name": "n", "type": "int256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "get_p", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "read_user_tick_numbers", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "int256[2]" }] }, { "stateMutability": "view", "type": "function", "name": "can_skip_bands", "inputs": [{ "name": "n_end", "type": "int256" }], "outputs": [{ "name": "", "type": "bool" }] }, { "stateMutability": "view", "type": "function", "name": "active_band_with_skip", "inputs": [], "outputs": [{ "name": "", "type": "int256" }] }, { "stateMutability": "view", "type": "function", "name": "has_liquidity", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "bool" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "deposit_range", "inputs": [{ "name": "user", "type": "address" }, { "name": "amount", "type": "uint256" }, { "name": "n1", "type": "int256" }, { "name": "n2", "type": "int256" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "withdraw", "inputs": [{ "name": "user", "type": "address" }, { "name": "frac", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256[2]" }] }, { "stateMutability": "view", "type": "function", "name": "get_dy", "inputs": [{ "name": "i", "type": "uint256" }, { "name": "j", "type": "uint256" }, { "name": "in_amount", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "get_dxdy", "inputs": [{ "name": "i", "type": "uint256" }, { "name": "j", "type": "uint256" }, { "name": "in_amount", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "get_dx", "inputs": [{ "name": "i", "type": "uint256" }, { "name": "j", "type": "uint256" }, { "name": "out_amount", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "get_dydx", "inputs": [{ "name": "i", "type": "uint256" }, { "name": "j", "type": "uint256" }, { "name": "out_amount", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "exchange", "inputs": [{ "name": "i", "type": "uint256" }, { "name": "j", "type": "uint256" }, { "name": "in_amount", "type": "uint256" }, { "name": "min_amount", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256[2]" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "exchange", "inputs": [{ "name": "i", "type": "uint256" }, { "name": "j", "type": "uint256" }, { "name": "in_amount", "type": "uint256" }, { "name": "min_amount", "type": "uint256" }, { "name": "_for", "type": "address" }], "outputs": [{ "name": "", "type": "uint256[2]" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "exchange_dy", "inputs": [{ "name": "i", "type": "uint256" }, { "name": "j", "type": "uint256" }, { "name": "out_amount", "type": "uint256" }, { "name": "max_amount", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256[2]" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "exchange_dy", "inputs": [{ "name": "i", "type": "uint256" }, { "name": "j", "type": "uint256" }, { "name": "out_amount", "type": "uint256" }, { "name": "max_amount", "type": "uint256" }, { "name": "_for", "type": "address" }], "outputs": [{ "name": "", "type": "uint256[2]" }] }, { "stateMutability": "view", "type": "function", "name": "get_y_up", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "get_x_down", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "get_sum_xy", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "uint256[2]" }] }, { "stateMutability": "view", "type": "function", "name": "get_xy", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "uint256[][2]" }] }, { "stateMutability": "view", "type": "function", "name": "get_amount_for_price", "inputs": [{ "name": "p", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "bool" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "set_rate", "inputs": [{ "name": "rate", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "set_fee", "inputs": [{ "name": "fee", "type": "uint256" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "set_admin_fee", "inputs": [{ "name": "fee", "type": "uint256" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "reset_admin_fees", "inputs": [], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "set_callback", "inputs": [{ "name": "liquidity_mining_callback", "type": "address" }], "outputs": [] }, { "stateMutability": "view", "type": "function", "name": "admin", "inputs": [], "outputs": [{ "name": "", "type": "address" }] }, { "stateMutability": "view", "type": "function", "name": "A", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "fee", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "admin_fee", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "rate", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "active_band", "inputs": [], "outputs": [{ "name": "", "type": "int256" }] }, { "stateMutability": "view", "type": "function", "name": "min_band", "inputs": [], "outputs": [{ "name": "", "type": "int256" }] }, { "stateMutability": "view", "type": "function", "name": "max_band", "inputs": [], "outputs": [{ "name": "", "type": "int256" }] }, { "stateMutability": "view", "type": "function", "name": "admin_fees_x", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "admin_fees_y", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "price_oracle_contract", "inputs": [], "outputs": [{ "name": "", "type": "address" }] }, { "stateMutability": "view", "type": "function", "name": "bands_x", "inputs": [{ "name": "arg0", "type": "int256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "bands_y", "inputs": [{ "name": "arg0", "type": "int256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "liquidity_mining_callback", "inputs": [], "outputs": [{ "name": "", "type": "address" }] }],
461
469
  "networks": {
@@ -488,6 +496,14 @@ module.exports = {
488
496
  }
489
497
  }
490
498
  },
499
+ "crvUSDsfrxETHAmm": {
500
+ "abi": [{ "name": "TokenExchange", "inputs": [{ "name": "buyer", "type": "address", "indexed": true }, { "name": "sold_id", "type": "uint256", "indexed": false }, { "name": "tokens_sold", "type": "uint256", "indexed": false }, { "name": "bought_id", "type": "uint256", "indexed": false }, { "name": "tokens_bought", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "Deposit", "inputs": [{ "name": "provider", "type": "address", "indexed": true }, { "name": "amount", "type": "uint256", "indexed": false }, { "name": "n1", "type": "int256", "indexed": false }, { "name": "n2", "type": "int256", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "Withdraw", "inputs": [{ "name": "provider", "type": "address", "indexed": true }, { "name": "amount_borrowed", "type": "uint256", "indexed": false }, { "name": "amount_collateral", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "SetRate", "inputs": [{ "name": "rate", "type": "uint256", "indexed": false }, { "name": "rate_mul", "type": "uint256", "indexed": false }, { "name": "time", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "SetFee", "inputs": [{ "name": "fee", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "SetAdminFee", "inputs": [{ "name": "fee", "type": "uint256", "indexed": false }], "anonymous": false, "type": "event" }, { "stateMutability": "nonpayable", "type": "constructor", "inputs": [{ "name": "_borrowed_token", "type": "address" }, { "name": "_borrowed_precision", "type": "uint256" }, { "name": "_collateral_token", "type": "address" }, { "name": "_collateral_precision", "type": "uint256" }, { "name": "_A", "type": "uint256" }, { "name": "_sqrt_band_ratio", "type": "uint256" }, { "name": "_log_A_ratio", "type": "int256" }, { "name": "_base_price", "type": "uint256" }, { "name": "fee", "type": "uint256" }, { "name": "admin_fee", "type": "uint256" }, { "name": "_price_oracle_contract", "type": "address" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "set_admin", "inputs": [{ "name": "_admin", "type": "address" }], "outputs": [] }, { "stateMutability": "pure", "type": "function", "name": "coins", "inputs": [{ "name": "i", "type": "uint256" }], "outputs": [{ "name": "", "type": "address" }] }, { "stateMutability": "view", "type": "function", "name": "price_oracle", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "dynamic_fee", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "get_rate_mul", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "get_base_price", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "p_current_up", "inputs": [{ "name": "n", "type": "int256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "p_current_down", "inputs": [{ "name": "n", "type": "int256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "p_oracle_up", "inputs": [{ "name": "n", "type": "int256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "p_oracle_down", "inputs": [{ "name": "n", "type": "int256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "get_p", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "read_user_tick_numbers", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "int256[2]" }] }, { "stateMutability": "view", "type": "function", "name": "can_skip_bands", "inputs": [{ "name": "n_end", "type": "int256" }], "outputs": [{ "name": "", "type": "bool" }] }, { "stateMutability": "view", "type": "function", "name": "active_band_with_skip", "inputs": [], "outputs": [{ "name": "", "type": "int256" }] }, { "stateMutability": "view", "type": "function", "name": "has_liquidity", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "bool" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "deposit_range", "inputs": [{ "name": "user", "type": "address" }, { "name": "amount", "type": "uint256" }, { "name": "n1", "type": "int256" }, { "name": "n2", "type": "int256" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "withdraw", "inputs": [{ "name": "user", "type": "address" }, { "name": "frac", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256[2]" }] }, { "stateMutability": "view", "type": "function", "name": "get_dy", "inputs": [{ "name": "i", "type": "uint256" }, { "name": "j", "type": "uint256" }, { "name": "in_amount", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "get_dxdy", "inputs": [{ "name": "i", "type": "uint256" }, { "name": "j", "type": "uint256" }, { "name": "in_amount", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "get_dx", "inputs": [{ "name": "i", "type": "uint256" }, { "name": "j", "type": "uint256" }, { "name": "out_amount", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "get_dydx", "inputs": [{ "name": "i", "type": "uint256" }, { "name": "j", "type": "uint256" }, { "name": "out_amount", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "exchange", "inputs": [{ "name": "i", "type": "uint256" }, { "name": "j", "type": "uint256" }, { "name": "in_amount", "type": "uint256" }, { "name": "min_amount", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256[2]" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "exchange", "inputs": [{ "name": "i", "type": "uint256" }, { "name": "j", "type": "uint256" }, { "name": "in_amount", "type": "uint256" }, { "name": "min_amount", "type": "uint256" }, { "name": "_for", "type": "address" }], "outputs": [{ "name": "", "type": "uint256[2]" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "exchange_dy", "inputs": [{ "name": "i", "type": "uint256" }, { "name": "j", "type": "uint256" }, { "name": "out_amount", "type": "uint256" }, { "name": "max_amount", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256[2]" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "exchange_dy", "inputs": [{ "name": "i", "type": "uint256" }, { "name": "j", "type": "uint256" }, { "name": "out_amount", "type": "uint256" }, { "name": "max_amount", "type": "uint256" }, { "name": "_for", "type": "address" }], "outputs": [{ "name": "", "type": "uint256[2]" }] }, { "stateMutability": "view", "type": "function", "name": "get_y_up", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "get_x_down", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "get_sum_xy", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "uint256[2]" }] }, { "stateMutability": "view", "type": "function", "name": "get_xy", "inputs": [{ "name": "user", "type": "address" }], "outputs": [{ "name": "", "type": "uint256[][2]" }] }, { "stateMutability": "view", "type": "function", "name": "get_amount_for_price", "inputs": [{ "name": "p", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }, { "name": "", "type": "bool" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "set_rate", "inputs": [{ "name": "rate", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "nonpayable", "type": "function", "name": "set_fee", "inputs": [{ "name": "fee", "type": "uint256" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "set_admin_fee", "inputs": [{ "name": "fee", "type": "uint256" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "reset_admin_fees", "inputs": [], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "set_callback", "inputs": [{ "name": "liquidity_mining_callback", "type": "address" }], "outputs": [] }, { "stateMutability": "view", "type": "function", "name": "admin", "inputs": [], "outputs": [{ "name": "", "type": "address" }] }, { "stateMutability": "view", "type": "function", "name": "A", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "fee", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "admin_fee", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "rate", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "active_band", "inputs": [], "outputs": [{ "name": "", "type": "int256" }] }, { "stateMutability": "view", "type": "function", "name": "min_band", "inputs": [], "outputs": [{ "name": "", "type": "int256" }] }, { "stateMutability": "view", "type": "function", "name": "max_band", "inputs": [], "outputs": [{ "name": "", "type": "int256" }] }, { "stateMutability": "view", "type": "function", "name": "admin_fees_x", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "admin_fees_y", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "price_oracle_contract", "inputs": [], "outputs": [{ "name": "", "type": "address" }] }, { "stateMutability": "view", "type": "function", "name": "bands_x", "inputs": [{ "name": "arg0", "type": "int256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "bands_y", "inputs": [{ "name": "arg0", "type": "int256" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "liquidity_mining_callback", "inputs": [], "outputs": [{ "name": "", "type": "address" }] }],
501
+ "networks": {
502
+ "1": {
503
+ "address": "0xfA96ad0a9E64261dB86950e2dA362f5572c5c6fd"
504
+ }
505
+ }
506
+ },
491
507
  "crvUSDView": {
492
508
  "abi": [{ "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "uint256", "name": "collateral", "type": "uint256" }, { "internalType": "uint256", "name": "debt", "type": "uint256" }, { "internalType": "uint256", "name": "N", "type": "uint256" }], "name": "createLoanData", "outputs": [{ "components": [{ "internalType": "int256", "name": "health", "type": "int256" }, { "internalType": "uint256", "name": "minColl", "type": "uint256" }, { "internalType": "uint256", "name": "maxBorrow", "type": "uint256" }, { "components": [{ "internalType": "int256", "name": "id", "type": "int256" }, { "internalType": "uint256", "name": "lowPrice", "type": "uint256" }, { "internalType": "uint256", "name": "highPrice", "type": "uint256" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }], "internalType": "struct CurveUsdView.Band[]", "name": "bands", "type": "tuple[]" }], "internalType": "struct CurveUsdView.CreateLoanData", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "int256", "name": "n", "type": "int256" }], "name": "getBandData", "outputs": [{ "components": [{ "internalType": "int256", "name": "id", "type": "int256" }, { "internalType": "uint256", "name": "lowPrice", "type": "uint256" }, { "internalType": "uint256", "name": "highPrice", "type": "uint256" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }], "internalType": "struct CurveUsdView.Band", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "uint256", "name": "collateral", "type": "uint256" }, { "internalType": "uint256", "name": "debt", "type": "uint256" }, { "internalType": "uint256", "name": "N", "type": "uint256" }], "name": "getBandsData", "outputs": [{ "components": [{ "internalType": "int256", "name": "id", "type": "int256" }, { "internalType": "uint256", "name": "lowPrice", "type": "uint256" }, { "internalType": "uint256", "name": "highPrice", "type": "uint256" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }], "internalType": "struct CurveUsdView.Band[]", "name": "bands", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "int256", "name": "from", "type": "int256" }, { "internalType": "int256", "name": "to", "type": "int256" }], "name": "getBandsData", "outputs": [{ "components": [{ "internalType": "int256", "name": "id", "type": "int256" }, { "internalType": "uint256", "name": "lowPrice", "type": "uint256" }, { "internalType": "uint256", "name": "highPrice", "type": "uint256" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }], "internalType": "struct CurveUsdView.Band[]", "name": "", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }], "name": "globalData", "outputs": [{ "components": [{ "internalType": "address", "name": "collateral", "type": "address" }, { "internalType": "uint256", "name": "decimals", "type": "uint256" }, { "internalType": "int256", "name": "activeBand", "type": "int256" }, { "internalType": "uint256", "name": "A", "type": "uint256" }, { "internalType": "uint256", "name": "totalDebt", "type": "uint256" }, { "internalType": "uint256", "name": "ammPrice", "type": "uint256" }, { "internalType": "uint256", "name": "basePrice", "type": "uint256" }, { "internalType": "uint256", "name": "oraclePrice", "type": "uint256" }, { "internalType": "uint256", "name": "minted", "type": "uint256" }, { "internalType": "uint256", "name": "redeemed", "type": "uint256" }, { "internalType": "uint256", "name": "monetaryPolicyRate", "type": "uint256" }, { "internalType": "uint256", "name": "ammRate", "type": "uint256" }, { "internalType": "int256", "name": "minBand", "type": "int256" }, { "internalType": "int256", "name": "maxBand", "type": "int256" }], "internalType": "struct CurveUsdView.GlobalData", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "address", "name": "user", "type": "address" }, { "internalType": "int256", "name": "collChange", "type": "int256" }, { "internalType": "int256", "name": "debtChange", "type": "int256" }, { "internalType": "bool", "name": "isFull", "type": "bool" }, { "internalType": "uint256", "name": "numBands", "type": "uint256" }], "name": "healthCalculator", "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "uint256", "name": "collateral", "type": "uint256" }, { "internalType": "uint256", "name": "N", "type": "uint256" }], "name": "maxBorrow", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "uint256", "name": "debt", "type": "uint256" }, { "internalType": "uint256", "name": "N", "type": "uint256" }], "name": "minCollateral", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "address", "name": "user", "type": "address" }], "name": "userData", "outputs": [{ "components": [{ "internalType": "bool", "name": "loanExists", "type": "bool" }, { "internalType": "uint256", "name": "collateralPrice", "type": "uint256" }, { "internalType": "uint256", "name": "marketCollateralAmount", "type": "uint256" }, { "internalType": "uint256", "name": "curveUsdCollateralAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }, { "internalType": "uint256", "name": "N", "type": "uint256" }, { "internalType": "uint256", "name": "priceLow", "type": "uint256" }, { "internalType": "uint256", "name": "priceHigh", "type": "uint256" }, { "internalType": "uint256", "name": "liquidationDiscount", "type": "uint256" }, { "internalType": "int256", "name": "health", "type": "int256" }, { "internalType": "int256[2]", "name": "bandRange", "type": "int256[2]" }, { "internalType": "uint256[][2]", "name": "usersBands", "type": "uint256[][2]" }], "internalType": "struct CurveUsdView.UserData", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }],
493
509
  "networks": {
@@ -98,5 +98,10 @@ export const aaveAnyGetAggregatedPositionData = (_a) => {
98
98
  }
99
99
  payload.liquidationPrice = calcLeverageLiqPrice(leveragedType, assetPrice, payload.borrowedUsd, payload.liquidationLimitUsd);
100
100
  }
101
+ payload.suppliedEth = new Dec(payload.suppliedUsd).div(assetsData.ETH.price).toString();
102
+ payload.borrowedEth = new Dec(payload.borrowedUsd).div(assetsData.ETH.price).toString();
103
+ payload.leftToBorrowEth = new Dec(payload.leftToBorrowUsd).div(assetsData.ETH.price).toString();
104
+ payload.borrowLimitEth = new Dec(payload.borrowLimitUsd).div(assetsData.ETH.price).toString();
105
+ payload.liquidationLimitEth = new Dec(payload.liquidationLimitUsd).div(assetsData.ETH.price).toString();
101
106
  return payload;
102
107
  };
@@ -4,4 +4,5 @@ import { LiquityTroveInfo } from '../types';
4
4
  export declare const LIQUITY_NORMAL_MODE_RATIO = 110;
5
5
  export declare const LIQUITY_RECOVERY_MODE_RATIO = 150;
6
6
  export declare const getLiquityAccountBalances: (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress) => Promise<PositionBalances>;
7
+ export declare const getDebtInFront: (viewContract: any, address: string, accumulatedSum?: string, iterations?: number) => Promise<string>;
7
8
  export declare const getLiquityTroveInfo: (web3: Web3, network: NetworkNumber, address: string) => Promise<LiquityTroveInfo>;
@@ -12,6 +12,7 @@ import { assetAmountInEth, getAssetInfo } from '@defisaver/tokens';
12
12
  import { LiquityActivePoolContract, LiquityCollSurplusPoolContract, LiquityPriceFeedContract, LiquityTroveManagerContract, LiquityViewContract, } from '../contracts';
13
13
  import { multicall } from '../multicall';
14
14
  import { LIQUITY_TROVE_STATUS_ENUM } from '../types';
15
+ import { ZERO_ADDRESS } from '../constants';
15
16
  export const LIQUITY_NORMAL_MODE_RATIO = 110; // MCR
16
17
  export const LIQUITY_RECOVERY_MODE_RATIO = 150; // CCR
17
18
  export const getLiquityAccountBalances = (web3, network, block, addressMapping, address) => __awaiter(void 0, void 0, void 0, function* () {
@@ -34,6 +35,13 @@ export const getLiquityAccountBalances = (web3, network, block, addressMapping,
34
35
  };
35
36
  return balances;
36
37
  });
38
+ const _getDebtInFront = (viewContract, address, accumulatedSum = '0', iterations = 2000) => __awaiter(void 0, void 0, void 0, function* () { return viewContract.methods.getDebtInFront(address, accumulatedSum, iterations).call(); });
39
+ export const getDebtInFront = (viewContract, address, accumulatedSum = '0', iterations = 2000) => __awaiter(void 0, void 0, void 0, function* () {
40
+ const { debt, next } = yield _getDebtInFront(viewContract, address, accumulatedSum, iterations);
41
+ if (next === ZERO_ADDRESS)
42
+ return assetAmountInEth(debt, 'LUSD');
43
+ return getDebtInFront(viewContract, next, debt, iterations);
44
+ });
37
45
  export const getLiquityTroveInfo = (web3, network, address) => __awaiter(void 0, void 0, void 0, function* () {
38
46
  const viewContract = LiquityViewContract(web3, network);
39
47
  const collSurplusPoolContract = LiquityCollSurplusPoolContract(web3, network);
@@ -72,7 +80,10 @@ export const getLiquityTroveInfo = (web3, network, address) => __awaiter(void 0,
72
80
  params: [],
73
81
  },
74
82
  ];
75
- const multiRes = yield multicall(multicallData, web3, network);
83
+ const [multiRes, debtInFront] = yield Promise.all([
84
+ multicall(multicallData, web3, network),
85
+ getDebtInFront(viewContract, address),
86
+ ]);
76
87
  const recoveryMode = multiRes[0][6];
77
88
  const totalETH = multiRes[4][0];
78
89
  const totalLUSD = multiRes[5][0];
@@ -87,6 +98,7 @@ export const getLiquityTroveInfo = (web3, network, address) => __awaiter(void 0,
87
98
  assetPrice: assetAmountInEth(multiRes[3][0]),
88
99
  totalETH,
89
100
  totalLUSD,
101
+ debtInFront,
90
102
  minCollateralRatio: recoveryMode ? LIQUITY_RECOVERY_MODE_RATIO : LIQUITY_NORMAL_MODE_RATIO,
91
103
  priceForRecovery: new Dec(recoveryMode ? LIQUITY_RECOVERY_MODE_RATIO : LIQUITY_NORMAL_MODE_RATIO).mul(totalLUSD).div(totalETH).div(100)
92
104
  .toString(),
@@ -4,9 +4,11 @@ export declare const CRVUSD_WSTETH_MARKET: (networkId: NetworkNumber) => CrvUSDM
4
4
  export declare const CRVUSD_ETH_MARKET: (networkId: NetworkNumber) => CrvUSDMarketData;
5
5
  export declare const CRVUSD_WBTC_MARKET: (networkId: NetworkNumber) => CrvUSDMarketData;
6
6
  export declare const CRVUSD_TBTC_MARKET: (networkId: NetworkNumber) => CrvUSDMarketData;
7
+ export declare const CRVUSD_SFRXETH_MARKET: (networkId: NetworkNumber) => CrvUSDMarketData;
7
8
  export declare const CrvUsdMarkets: (networkId: NetworkNumber) => {
8
9
  readonly wstETH: CrvUSDMarketData;
9
10
  readonly ETH: CrvUSDMarketData;
10
11
  readonly WBTC: CrvUSDMarketData;
11
12
  readonly tBTC: CrvUSDMarketData;
13
+ readonly sfrxETH: CrvUSDMarketData;
12
14
  };
@@ -44,9 +44,21 @@ export const CRVUSD_TBTC_MARKET = (networkId) => ({
44
44
  ammAddress: getConfigContractAddress('crvUSDtBTCAmm', networkId),
45
45
  createCollAssets: ['tBTC'],
46
46
  });
47
+ export const CRVUSD_SFRXETH_MARKET = (networkId) => ({
48
+ chainIds: [1],
49
+ label: 'sfrxETH',
50
+ shortLabel: 'sfrxETH',
51
+ value: CrvUSDVersions.sfrxETH,
52
+ collAsset: 'sfrxETH',
53
+ baseAsset: 'crvUSD',
54
+ controllerAddress: getConfigContractAddress('crvUSDsfrxETHController', networkId),
55
+ ammAddress: getConfigContractAddress('crvUSDsfrxETHAmm', networkId),
56
+ createCollAssets: ['sfrxETH'],
57
+ });
47
58
  export const CrvUsdMarkets = (networkId) => ({
48
59
  [CrvUSDVersions.wstETH]: CRVUSD_WSTETH_MARKET(networkId),
49
60
  [CrvUSDVersions.ETH]: CRVUSD_ETH_MARKET(networkId),
50
61
  [CrvUSDVersions.WBTC]: CRVUSD_WBTC_MARKET(networkId),
51
62
  [CrvUSDVersions.tBTC]: CRVUSD_TBTC_MARKET(networkId),
63
+ [CrvUSDVersions.sfrxETH]: CRVUSD_SFRXETH_MARKET(networkId),
52
64
  });
@@ -3,5 +3,5 @@ import { Blockish, EthAddress, NetworkNumber, PositionBalances } from '../types/
3
3
  import { MorphoAaveV3AssetsData, MorphoAaveV3MarketData, MorphoAaveV3MarketInfo, MorphoAaveV3PositionData } from '../types';
4
4
  export declare const getMorphoAaveV3MarketsData: (web3: Web3, network: NetworkNumber, selectedMarket: MorphoAaveV3MarketInfo, mainnetWeb3: Web3) => Promise<MorphoAaveV3MarketData>;
5
5
  export declare const getMorphoAaveV3AccountBalances: (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress) => Promise<PositionBalances>;
6
- export declare const getMorphoAaveV3AccountData: (web3: Web3, network: NetworkNumber, address: string, assetsData: MorphoAaveV3AssetsData, delegator: string, selectedMarket: MorphoAaveV3MarketInfo, customGetAggregatedDataFunction?: Function) => Promise<MorphoAaveV3PositionData>;
6
+ export declare const getMorphoAaveV3AccountData: (web3: Web3, network: NetworkNumber, address: string, assetsData: MorphoAaveV3AssetsData, delegator: string, selectedMarket: MorphoAaveV3MarketInfo) => Promise<MorphoAaveV3PositionData>;
7
7
  export declare const getMorphoAaveV3FullPositionData: (web3: Web3, network: NetworkNumber, address: string, delegator: string, market: MorphoAaveV3MarketInfo, mainnetWeb3: Web3) => Promise<MorphoAaveV3PositionData>;
@@ -308,7 +308,7 @@ export const getMorphoAaveV3AccountBalances = (web3, network, block, addressMapp
308
308
  });
309
309
  return balances;
310
310
  });
311
- export const getMorphoAaveV3AccountData = (web3, network, address, assetsData, delegator, selectedMarket, customGetAggregatedDataFunction) => __awaiter(void 0, void 0, void 0, function* () {
311
+ export const getMorphoAaveV3AccountData = (web3, network, address, assetsData, delegator, selectedMarket) => __awaiter(void 0, void 0, void 0, function* () {
312
312
  var _g;
313
313
  if (!address) {
314
314
  throw new Error('No address provided.');
@@ -413,8 +413,7 @@ export const getMorphoAaveV3AccountData = (web3, network, address, assetsData, d
413
413
  };
414
414
  }
415
415
  });
416
- const aggregateFunction = customGetAggregatedDataFunction || aaveAnyGetAggregatedPositionData;
417
- payload = Object.assign(Object.assign({}, payload), aggregateFunction({
416
+ payload = Object.assign(Object.assign({}, payload), aaveAnyGetAggregatedPositionData({
418
417
  usedAssets: payload.usedAssets, assetsData, eModeCategory, selectedMarket,
419
418
  }));
420
419
  // Calculate borrow limits per asset
@@ -199,11 +199,16 @@ export interface AaveV3IncentiveData {
199
199
  }
200
200
  export interface AaveV3AggregatedPositionData {
201
201
  suppliedUsd: string;
202
+ suppliedEth: string;
202
203
  suppliedCollateralUsd: string;
203
204
  borrowedUsd: string;
205
+ borrowedEth: string;
204
206
  borrowLimitUsd: string;
207
+ borrowLimitEth: string;
205
208
  liquidationLimitUsd: string;
209
+ liquidationLimitEth: string;
206
210
  leftToBorrowUsd: string;
211
+ leftToBorrowEth: string;
207
212
  ratio: string;
208
213
  collRatio: string;
209
214
  netApy: string;
@@ -0,0 +1,139 @@
1
+ /// <reference types="node" />
2
+ import type BN from "bn.js";
3
+ import type { ContractOptions } from "web3-eth-contract";
4
+ import type { EventLog } from "web3-core";
5
+ import type { EventEmitter } from "events";
6
+ import type { Callback, NonPayableTransactionObject, BlockType, ContractEventLog, BaseContract } from "./types";
7
+ export interface EventOptions {
8
+ filter?: object;
9
+ fromBlock?: BlockType;
10
+ topics?: string[];
11
+ }
12
+ export type TokenExchange = ContractEventLog<{
13
+ buyer: string;
14
+ sold_id: string;
15
+ tokens_sold: string;
16
+ bought_id: string;
17
+ tokens_bought: string;
18
+ 0: string;
19
+ 1: string;
20
+ 2: string;
21
+ 3: string;
22
+ 4: string;
23
+ }>;
24
+ export type Deposit = ContractEventLog<{
25
+ provider: string;
26
+ amount: string;
27
+ n1: string;
28
+ n2: string;
29
+ 0: string;
30
+ 1: string;
31
+ 2: string;
32
+ 3: string;
33
+ }>;
34
+ export type Withdraw = ContractEventLog<{
35
+ provider: string;
36
+ amount_borrowed: string;
37
+ amount_collateral: string;
38
+ 0: string;
39
+ 1: string;
40
+ 2: string;
41
+ }>;
42
+ export type SetRate = ContractEventLog<{
43
+ rate: string;
44
+ rate_mul: string;
45
+ time: string;
46
+ 0: string;
47
+ 1: string;
48
+ 2: string;
49
+ }>;
50
+ export type SetFee = ContractEventLog<{
51
+ fee: string;
52
+ 0: string;
53
+ }>;
54
+ export type SetAdminFee = ContractEventLog<{
55
+ fee: string;
56
+ 0: string;
57
+ }>;
58
+ export interface CrvUSDsfrxETHAmm extends BaseContract {
59
+ constructor(jsonInterface: any[], address?: string, options?: ContractOptions): CrvUSDsfrxETHAmm;
60
+ clone(): CrvUSDsfrxETHAmm;
61
+ methods: {
62
+ set_admin(_admin: string): NonPayableTransactionObject<void>;
63
+ coins(i: number | string | BN): NonPayableTransactionObject<string>;
64
+ price_oracle(): NonPayableTransactionObject<string>;
65
+ dynamic_fee(): NonPayableTransactionObject<string>;
66
+ get_rate_mul(): NonPayableTransactionObject<string>;
67
+ get_base_price(): NonPayableTransactionObject<string>;
68
+ p_current_up(n: number | string | BN): NonPayableTransactionObject<string>;
69
+ p_current_down(n: number | string | BN): NonPayableTransactionObject<string>;
70
+ p_oracle_up(n: number | string | BN): NonPayableTransactionObject<string>;
71
+ p_oracle_down(n: number | string | BN): NonPayableTransactionObject<string>;
72
+ get_p(): NonPayableTransactionObject<string>;
73
+ read_user_tick_numbers(user: string): NonPayableTransactionObject<[string, string]>;
74
+ can_skip_bands(n_end: number | string | BN): NonPayableTransactionObject<boolean>;
75
+ active_band_with_skip(): NonPayableTransactionObject<string>;
76
+ has_liquidity(user: string): NonPayableTransactionObject<boolean>;
77
+ deposit_range(user: string, amount: number | string | BN, n1: number | string | BN, n2: number | string | BN): NonPayableTransactionObject<void>;
78
+ withdraw(user: string, frac: number | string | BN): NonPayableTransactionObject<[string, string]>;
79
+ get_dy(i: number | string | BN, j: number | string | BN, in_amount: number | string | BN): NonPayableTransactionObject<string>;
80
+ get_dxdy(i: number | string | BN, j: number | string | BN, in_amount: number | string | BN): NonPayableTransactionObject<[string, string]>;
81
+ get_dx(i: number | string | BN, j: number | string | BN, out_amount: number | string | BN): NonPayableTransactionObject<string>;
82
+ get_dydx(i: number | string | BN, j: number | string | BN, out_amount: number | string | BN): NonPayableTransactionObject<[string, string]>;
83
+ "exchange(uint256,uint256,uint256,uint256)"(i: number | string | BN, j: number | string | BN, in_amount: number | string | BN, min_amount: number | string | BN): NonPayableTransactionObject<[string, string]>;
84
+ "exchange(uint256,uint256,uint256,uint256,address)"(i: number | string | BN, j: number | string | BN, in_amount: number | string | BN, min_amount: number | string | BN, _for: string): NonPayableTransactionObject<[string, string]>;
85
+ "exchange_dy(uint256,uint256,uint256,uint256)"(i: number | string | BN, j: number | string | BN, out_amount: number | string | BN, max_amount: number | string | BN): NonPayableTransactionObject<[string, string]>;
86
+ "exchange_dy(uint256,uint256,uint256,uint256,address)"(i: number | string | BN, j: number | string | BN, out_amount: number | string | BN, max_amount: number | string | BN, _for: string): NonPayableTransactionObject<[string, string]>;
87
+ get_y_up(user: string): NonPayableTransactionObject<string>;
88
+ get_x_down(user: string): NonPayableTransactionObject<string>;
89
+ get_sum_xy(user: string): NonPayableTransactionObject<[string, string]>;
90
+ get_xy(user: string): NonPayableTransactionObject<[string[], string[]]>;
91
+ get_amount_for_price(p: number | string | BN): NonPayableTransactionObject<[string, boolean]>;
92
+ set_rate(rate: number | string | BN): NonPayableTransactionObject<string>;
93
+ set_fee(fee: number | string | BN): NonPayableTransactionObject<void>;
94
+ set_admin_fee(fee: number | string | BN): NonPayableTransactionObject<void>;
95
+ reset_admin_fees(): NonPayableTransactionObject<void>;
96
+ set_callback(liquidity_mining_callback: string): NonPayableTransactionObject<void>;
97
+ admin(): NonPayableTransactionObject<string>;
98
+ A(): NonPayableTransactionObject<string>;
99
+ fee(): NonPayableTransactionObject<string>;
100
+ admin_fee(): NonPayableTransactionObject<string>;
101
+ rate(): NonPayableTransactionObject<string>;
102
+ active_band(): NonPayableTransactionObject<string>;
103
+ min_band(): NonPayableTransactionObject<string>;
104
+ max_band(): NonPayableTransactionObject<string>;
105
+ admin_fees_x(): NonPayableTransactionObject<string>;
106
+ admin_fees_y(): NonPayableTransactionObject<string>;
107
+ price_oracle_contract(): NonPayableTransactionObject<string>;
108
+ bands_x(arg0: number | string | BN): NonPayableTransactionObject<string>;
109
+ bands_y(arg0: number | string | BN): NonPayableTransactionObject<string>;
110
+ liquidity_mining_callback(): NonPayableTransactionObject<string>;
111
+ };
112
+ events: {
113
+ TokenExchange(cb?: Callback<TokenExchange>): EventEmitter;
114
+ TokenExchange(options?: EventOptions, cb?: Callback<TokenExchange>): EventEmitter;
115
+ Deposit(cb?: Callback<Deposit>): EventEmitter;
116
+ Deposit(options?: EventOptions, cb?: Callback<Deposit>): EventEmitter;
117
+ Withdraw(cb?: Callback<Withdraw>): EventEmitter;
118
+ Withdraw(options?: EventOptions, cb?: Callback<Withdraw>): EventEmitter;
119
+ SetRate(cb?: Callback<SetRate>): EventEmitter;
120
+ SetRate(options?: EventOptions, cb?: Callback<SetRate>): EventEmitter;
121
+ SetFee(cb?: Callback<SetFee>): EventEmitter;
122
+ SetFee(options?: EventOptions, cb?: Callback<SetFee>): EventEmitter;
123
+ SetAdminFee(cb?: Callback<SetAdminFee>): EventEmitter;
124
+ SetAdminFee(options?: EventOptions, cb?: Callback<SetAdminFee>): EventEmitter;
125
+ allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
126
+ };
127
+ once(event: "TokenExchange", cb: Callback<TokenExchange>): void;
128
+ once(event: "TokenExchange", options: EventOptions, cb: Callback<TokenExchange>): void;
129
+ once(event: "Deposit", cb: Callback<Deposit>): void;
130
+ once(event: "Deposit", options: EventOptions, cb: Callback<Deposit>): void;
131
+ once(event: "Withdraw", cb: Callback<Withdraw>): void;
132
+ once(event: "Withdraw", options: EventOptions, cb: Callback<Withdraw>): void;
133
+ once(event: "SetRate", cb: Callback<SetRate>): void;
134
+ once(event: "SetRate", options: EventOptions, cb: Callback<SetRate>): void;
135
+ once(event: "SetFee", cb: Callback<SetFee>): void;
136
+ once(event: "SetFee", options: EventOptions, cb: Callback<SetFee>): void;
137
+ once(event: "SetAdminFee", cb: Callback<SetAdminFee>): void;
138
+ once(event: "SetAdminFee", options: EventOptions, cb: Callback<SetAdminFee>): void;
139
+ }
@@ -0,0 +1,4 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export {};