@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
@@ -457,6 +457,14 @@ module.exports = {
457
457
  }
458
458
  }
459
459
  },
460
+ "crvUSDsfrxETHController": {
461
+ "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" }] }],
462
+ "networks": {
463
+ "1": {
464
+ "address": "0xEC0820EfafC41D8943EE8dE495fC9Ba8495B15cf"
465
+ }
466
+ }
467
+ },
460
468
  "crvUSDwstETHAmm": {
461
469
  "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" }] }],
462
470
  "networks": {
@@ -489,6 +497,14 @@ module.exports = {
489
497
  }
490
498
  }
491
499
  },
500
+ "crvUSDsfrxETHAmm": {
501
+ "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" }] }],
502
+ "networks": {
503
+ "1": {
504
+ "address": "0xfA96ad0a9E64261dB86950e2dA362f5572c5c6fd"
505
+ }
506
+ }
507
+ },
492
508
  "crvUSDView": {
493
509
  "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" }],
494
510
  "networks": {
@@ -114,6 +114,11 @@ const aaveAnyGetAggregatedPositionData = (_a) => {
114
114
  }
115
115
  payload.liquidationPrice = (0, moneymarket_1.calcLeverageLiqPrice)(leveragedType, assetPrice, payload.borrowedUsd, payload.liquidationLimitUsd);
116
116
  }
117
+ payload.suppliedEth = new decimal_js_1.default(payload.suppliedUsd).div(assetsData.ETH.price).toString();
118
+ payload.borrowedEth = new decimal_js_1.default(payload.borrowedUsd).div(assetsData.ETH.price).toString();
119
+ payload.leftToBorrowEth = new decimal_js_1.default(payload.leftToBorrowUsd).div(assetsData.ETH.price).toString();
120
+ payload.borrowLimitEth = new decimal_js_1.default(payload.borrowLimitUsd).div(assetsData.ETH.price).toString();
121
+ payload.liquidationLimitEth = new decimal_js_1.default(payload.liquidationLimitUsd).div(assetsData.ETH.price).toString();
117
122
  return payload;
118
123
  };
119
124
  exports.aaveAnyGetAggregatedPositionData = aaveAnyGetAggregatedPositionData;
@@ -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,12 +12,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getLiquityTroveInfo = exports.getLiquityAccountBalances = exports.LIQUITY_RECOVERY_MODE_RATIO = exports.LIQUITY_NORMAL_MODE_RATIO = void 0;
15
+ exports.getLiquityTroveInfo = exports.getDebtInFront = exports.getLiquityAccountBalances = exports.LIQUITY_RECOVERY_MODE_RATIO = exports.LIQUITY_NORMAL_MODE_RATIO = void 0;
16
16
  const decimal_js_1 = __importDefault(require("decimal.js"));
17
17
  const tokens_1 = require("@defisaver/tokens");
18
18
  const contracts_1 = require("../contracts");
19
19
  const multicall_1 = require("../multicall");
20
20
  const types_1 = require("../types");
21
+ const constants_1 = require("../constants");
21
22
  exports.LIQUITY_NORMAL_MODE_RATIO = 110; // MCR
22
23
  exports.LIQUITY_RECOVERY_MODE_RATIO = 150; // CCR
23
24
  const getLiquityAccountBalances = (web3, network, block, addressMapping, address) => __awaiter(void 0, void 0, void 0, function* () {
@@ -41,6 +42,14 @@ const getLiquityAccountBalances = (web3, network, block, addressMapping, address
41
42
  return balances;
42
43
  });
43
44
  exports.getLiquityAccountBalances = getLiquityAccountBalances;
45
+ const _getDebtInFront = (viewContract, address, accumulatedSum = '0', iterations = 2000) => __awaiter(void 0, void 0, void 0, function* () { return viewContract.methods.getDebtInFront(address, accumulatedSum, iterations).call(); });
46
+ const getDebtInFront = (viewContract, address, accumulatedSum = '0', iterations = 2000) => __awaiter(void 0, void 0, void 0, function* () {
47
+ const { debt, next } = yield _getDebtInFront(viewContract, address, accumulatedSum, iterations);
48
+ if (next === constants_1.ZERO_ADDRESS)
49
+ return (0, tokens_1.assetAmountInEth)(debt, 'LUSD');
50
+ return (0, exports.getDebtInFront)(viewContract, next, debt, iterations);
51
+ });
52
+ exports.getDebtInFront = getDebtInFront;
44
53
  const getLiquityTroveInfo = (web3, network, address) => __awaiter(void 0, void 0, void 0, function* () {
45
54
  const viewContract = (0, contracts_1.LiquityViewContract)(web3, network);
46
55
  const collSurplusPoolContract = (0, contracts_1.LiquityCollSurplusPoolContract)(web3, network);
@@ -79,7 +88,10 @@ const getLiquityTroveInfo = (web3, network, address) => __awaiter(void 0, void 0
79
88
  params: [],
80
89
  },
81
90
  ];
82
- const multiRes = yield (0, multicall_1.multicall)(multicallData, web3, network);
91
+ const [multiRes, debtInFront] = yield Promise.all([
92
+ (0, multicall_1.multicall)(multicallData, web3, network),
93
+ (0, exports.getDebtInFront)(viewContract, address),
94
+ ]);
83
95
  const recoveryMode = multiRes[0][6];
84
96
  const totalETH = multiRes[4][0];
85
97
  const totalLUSD = multiRes[5][0];
@@ -94,6 +106,7 @@ const getLiquityTroveInfo = (web3, network, address) => __awaiter(void 0, void 0
94
106
  assetPrice: (0, tokens_1.assetAmountInEth)(multiRes[3][0]),
95
107
  totalETH,
96
108
  totalLUSD,
109
+ debtInFront,
97
110
  minCollateralRatio: recoveryMode ? exports.LIQUITY_RECOVERY_MODE_RATIO : exports.LIQUITY_NORMAL_MODE_RATIO,
98
111
  priceForRecovery: new decimal_js_1.default(recoveryMode ? exports.LIQUITY_RECOVERY_MODE_RATIO : exports.LIQUITY_NORMAL_MODE_RATIO).mul(totalLUSD).div(totalETH).div(100)
99
112
  .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
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CrvUsdMarkets = exports.CRVUSD_TBTC_MARKET = exports.CRVUSD_WBTC_MARKET = exports.CRVUSD_ETH_MARKET = exports.CRVUSD_WSTETH_MARKET = void 0;
3
+ exports.CrvUsdMarkets = exports.CRVUSD_SFRXETH_MARKET = exports.CRVUSD_TBTC_MARKET = exports.CRVUSD_WBTC_MARKET = exports.CRVUSD_ETH_MARKET = exports.CRVUSD_WSTETH_MARKET = void 0;
4
4
  const contracts_1 = require("../../contracts");
5
5
  const types_1 = require("../../types");
6
6
  const CRVUSD_WSTETH_MARKET = (networkId) => ({
@@ -51,10 +51,23 @@ const CRVUSD_TBTC_MARKET = (networkId) => ({
51
51
  createCollAssets: ['tBTC'],
52
52
  });
53
53
  exports.CRVUSD_TBTC_MARKET = CRVUSD_TBTC_MARKET;
54
+ const CRVUSD_SFRXETH_MARKET = (networkId) => ({
55
+ chainIds: [1],
56
+ label: 'sfrxETH',
57
+ shortLabel: 'sfrxETH',
58
+ value: types_1.CrvUSDVersions.sfrxETH,
59
+ collAsset: 'sfrxETH',
60
+ baseAsset: 'crvUSD',
61
+ controllerAddress: (0, contracts_1.getConfigContractAddress)('crvUSDsfrxETHController', networkId),
62
+ ammAddress: (0, contracts_1.getConfigContractAddress)('crvUSDsfrxETHAmm', networkId),
63
+ createCollAssets: ['sfrxETH'],
64
+ });
65
+ exports.CRVUSD_SFRXETH_MARKET = CRVUSD_SFRXETH_MARKET;
54
66
  const CrvUsdMarkets = (networkId) => ({
55
67
  [types_1.CrvUSDVersions.wstETH]: (0, exports.CRVUSD_WSTETH_MARKET)(networkId),
56
68
  [types_1.CrvUSDVersions.ETH]: (0, exports.CRVUSD_ETH_MARKET)(networkId),
57
69
  [types_1.CrvUSDVersions.WBTC]: (0, exports.CRVUSD_WBTC_MARKET)(networkId),
58
70
  [types_1.CrvUSDVersions.tBTC]: (0, exports.CRVUSD_TBTC_MARKET)(networkId),
71
+ [types_1.CrvUSDVersions.sfrxETH]: (0, exports.CRVUSD_SFRXETH_MARKET)(networkId),
59
72
  });
60
73
  exports.CrvUsdMarkets = CrvUsdMarkets;
@@ -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>;
@@ -316,7 +316,7 @@ const getMorphoAaveV3AccountBalances = (web3, network, block, addressMapping, ad
316
316
  return balances;
317
317
  });
318
318
  exports.getMorphoAaveV3AccountBalances = getMorphoAaveV3AccountBalances;
319
- const getMorphoAaveV3AccountData = (web3, network, address, assetsData, delegator, selectedMarket, customGetAggregatedDataFunction) => __awaiter(void 0, void 0, void 0, function* () {
319
+ const getMorphoAaveV3AccountData = (web3, network, address, assetsData, delegator, selectedMarket) => __awaiter(void 0, void 0, void 0, function* () {
320
320
  var _g;
321
321
  if (!address) {
322
322
  throw new Error('No address provided.');
@@ -421,8 +421,7 @@ const getMorphoAaveV3AccountData = (web3, network, address, assetsData, delegato
421
421
  };
422
422
  }
423
423
  });
424
- const aggregateFunction = customGetAggregatedDataFunction || aaveHelpers_1.aaveAnyGetAggregatedPositionData;
425
- payload = Object.assign(Object.assign({}, payload), aggregateFunction({
424
+ payload = Object.assign(Object.assign({}, payload), (0, aaveHelpers_1.aaveAnyGetAggregatedPositionData)({
426
425
  usedAssets: payload.usedAssets, assetsData, eModeCategory, selectedMarket,
427
426
  }));
428
427
  // 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,5 @@
1
+ "use strict";
2
+ /* Autogenerated file. Do not edit manually. */
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ Object.defineProperty(exports, "__esModule", { value: true });