@townsq/mm-sdk 1.0.1

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 (390) hide show
  1. package/README.md +95 -0
  2. package/dist/chains/evm/common/constant/abi/arbitrum-node-interface-abi.d.ts +25 -0
  3. package/dist/chains/evm/common/constant/abi/arbitrum-node-interface-abi.js +18 -0
  4. package/dist/chains/evm/common/constant/abi/arbitrum-node-interface-abi.js.map +1 -0
  5. package/dist/chains/evm/common/constant/abi/bridge-router-abi.d.ts +1030 -0
  6. package/dist/chains/evm/common/constant/abi/bridge-router-abi.js +794 -0
  7. package/dist/chains/evm/common/constant/abi/bridge-router-abi.js.map +1 -0
  8. package/dist/chains/evm/common/constant/abi/ccip-data-adapter-abi.d.ts +796 -0
  9. package/dist/chains/evm/common/constant/abi/ccip-data-adapter-abi.js +622 -0
  10. package/dist/chains/evm/common/constant/abi/ccip-data-adapter-abi.js.map +1 -0
  11. package/dist/chains/evm/common/constant/abi/erc-20-abi.d.ts +235 -0
  12. package/dist/chains/evm/common/constant/abi/erc-20-abi.js +157 -0
  13. package/dist/chains/evm/common/constant/abi/erc-20-abi.js.map +1 -0
  14. package/dist/chains/evm/common/constant/abi/wormhole-data-adapter-abi.d.ts +821 -0
  15. package/dist/chains/evm/common/constant/abi/wormhole-data-adapter-abi.js +645 -0
  16. package/dist/chains/evm/common/constant/abi/wormhole-data-adapter-abi.js.map +1 -0
  17. package/dist/chains/evm/common/constant/abi/wormhole-relayer-abi.d.ts +783 -0
  18. package/dist/chains/evm/common/constant/abi/wormhole-relayer-abi.js +501 -0
  19. package/dist/chains/evm/common/constant/abi/wormhole-relayer-abi.js.map +1 -0
  20. package/dist/chains/evm/common/constant/chain.d.ts +128 -0
  21. package/dist/chains/evm/common/constant/chain.js +62 -0
  22. package/dist/chains/evm/common/constant/chain.js.map +1 -0
  23. package/dist/chains/evm/common/constant/contract.d.ts +9 -0
  24. package/dist/chains/evm/common/constant/contract.js +13 -0
  25. package/dist/chains/evm/common/constant/contract.js.map +1 -0
  26. package/dist/chains/evm/common/constant/tokens.d.ts +6 -0
  27. package/dist/chains/evm/common/constant/tokens.js +21 -0
  28. package/dist/chains/evm/common/constant/tokens.js.map +1 -0
  29. package/dist/chains/evm/common/types/chain.d.ts +9 -0
  30. package/dist/chains/evm/common/types/chain.js +2 -0
  31. package/dist/chains/evm/common/types/chain.js.map +1 -0
  32. package/dist/chains/evm/common/types/contract.d.ts +8 -0
  33. package/dist/chains/evm/common/types/contract.js +2 -0
  34. package/dist/chains/evm/common/types/contract.js.map +1 -0
  35. package/dist/chains/evm/common/types/gmp.d.ts +37 -0
  36. package/dist/chains/evm/common/types/gmp.js +2 -0
  37. package/dist/chains/evm/common/types/gmp.js.map +1 -0
  38. package/dist/chains/evm/common/types/module.d.ts +90 -0
  39. package/dist/chains/evm/common/types/module.js +2 -0
  40. package/dist/chains/evm/common/types/module.js.map +1 -0
  41. package/dist/chains/evm/common/types/token.d.ts +28 -0
  42. package/dist/chains/evm/common/types/token.js +2 -0
  43. package/dist/chains/evm/common/types/token.js.map +1 -0
  44. package/dist/chains/evm/common/utils/chain.d.ts +7 -0
  45. package/dist/chains/evm/common/utils/chain.js +24 -0
  46. package/dist/chains/evm/common/utils/chain.js.map +1 -0
  47. package/dist/chains/evm/common/utils/contract.d.ts +7387 -0
  48. package/dist/chains/evm/common/utils/contract.js +67 -0
  49. package/dist/chains/evm/common/utils/contract.js.map +1 -0
  50. package/dist/chains/evm/common/utils/gmp.d.ts +7 -0
  51. package/dist/chains/evm/common/utils/gmp.js +32 -0
  52. package/dist/chains/evm/common/utils/gmp.js.map +1 -0
  53. package/dist/chains/evm/common/utils/message.d.ts +21 -0
  54. package/dist/chains/evm/common/utils/message.js +426 -0
  55. package/dist/chains/evm/common/utils/message.js.map +1 -0
  56. package/dist/chains/evm/common/utils/provider.d.ts +5 -0
  57. package/dist/chains/evm/common/utils/provider.js +24 -0
  58. package/dist/chains/evm/common/utils/provider.js.map +1 -0
  59. package/dist/chains/evm/common/utils/tokens.d.ts +11 -0
  60. package/dist/chains/evm/common/utils/tokens.js +58 -0
  61. package/dist/chains/evm/common/utils/tokens.js.map +1 -0
  62. package/dist/chains/evm/hub/constants/abi/account-manager-abi.d.ts +945 -0
  63. package/dist/chains/evm/hub/constants/abi/account-manager-abi.js +709 -0
  64. package/dist/chains/evm/hub/constants/abi/account-manager-abi.js.map +1 -0
  65. package/dist/chains/evm/hub/constants/abi/bridge-router-hub-abi.d.ts +1062 -0
  66. package/dist/chains/evm/hub/constants/abi/bridge-router-hub-abi.js +816 -0
  67. package/dist/chains/evm/hub/constants/abi/bridge-router-hub-abi.js.map +1 -0
  68. package/dist/chains/evm/hub/constants/abi/hub-abi.d.ts +344 -0
  69. package/dist/chains/evm/hub/constants/abi/hub-abi.js +229 -0
  70. package/dist/chains/evm/hub/constants/abi/hub-abi.js.map +1 -0
  71. package/dist/chains/evm/hub/constants/abi/hub-pool-abi.d.ts +1999 -0
  72. package/dist/chains/evm/hub/constants/abi/hub-pool-abi.js +1558 -0
  73. package/dist/chains/evm/hub/constants/abi/hub-pool-abi.js.map +1 -0
  74. package/dist/chains/evm/hub/constants/abi/hub-rewards-v1-abi.d.ts +850 -0
  75. package/dist/chains/evm/hub/constants/abi/hub-rewards-v1-abi.js +649 -0
  76. package/dist/chains/evm/hub/constants/abi/hub-rewards-v1-abi.js.map +1 -0
  77. package/dist/chains/evm/hub/constants/abi/hub-rewards-v2-abi.d.ts +1213 -0
  78. package/dist/chains/evm/hub/constants/abi/hub-rewards-v2-abi.js +890 -0
  79. package/dist/chains/evm/hub/constants/abi/hub-rewards-v2-abi.js.map +1 -0
  80. package/dist/chains/evm/hub/constants/abi/loan-manager-abi.d.ts +1573 -0
  81. package/dist/chains/evm/hub/constants/abi/loan-manager-abi.js +1055 -0
  82. package/dist/chains/evm/hub/constants/abi/loan-manager-abi.js.map +1 -0
  83. package/dist/chains/evm/hub/constants/abi/node-manager-abi.d.ts +269 -0
  84. package/dist/chains/evm/hub/constants/abi/node-manager-abi.js +228 -0
  85. package/dist/chains/evm/hub/constants/abi/node-manager-abi.js.map +1 -0
  86. package/dist/chains/evm/hub/constants/abi/oracle-manager-abi.d.ts +495 -0
  87. package/dist/chains/evm/hub/constants/abi/oracle-manager-abi.js +391 -0
  88. package/dist/chains/evm/hub/constants/abi/oracle-manager-abi.js.map +1 -0
  89. package/dist/chains/evm/hub/constants/chain.d.ts +3 -0
  90. package/dist/chains/evm/hub/constants/chain.js +242 -0
  91. package/dist/chains/evm/hub/constants/chain.js.map +1 -0
  92. package/dist/chains/evm/hub/modules/index.d.ts +5 -0
  93. package/dist/chains/evm/hub/modules/index.js +6 -0
  94. package/dist/chains/evm/hub/modules/index.js.map +1 -0
  95. package/dist/chains/evm/hub/modules/ts-hub-account.d.ts +8 -0
  96. package/dist/chains/evm/hub/modules/ts-hub-account.js +75 -0
  97. package/dist/chains/evm/hub/modules/ts-hub-account.js.map +1 -0
  98. package/dist/chains/evm/hub/modules/ts-hub-gmp.d.ts +18 -0
  99. package/dist/chains/evm/hub/modules/ts-hub-gmp.js +98 -0
  100. package/dist/chains/evm/hub/modules/ts-hub-gmp.js.map +1 -0
  101. package/dist/chains/evm/hub/modules/ts-hub-loan.d.ts +27 -0
  102. package/dist/chains/evm/hub/modules/ts-hub-loan.js +484 -0
  103. package/dist/chains/evm/hub/modules/ts-hub-loan.js.map +1 -0
  104. package/dist/chains/evm/hub/modules/ts-hub-oracle.d.ts +8 -0
  105. package/dist/chains/evm/hub/modules/ts-hub-oracle.js +58 -0
  106. package/dist/chains/evm/hub/modules/ts-hub-oracle.js.map +1 -0
  107. package/dist/chains/evm/hub/modules/ts-hub-pool.d.ts +5 -0
  108. package/dist/chains/evm/hub/modules/ts-hub-pool.js +138 -0
  109. package/dist/chains/evm/hub/modules/ts-hub-pool.js.map +1 -0
  110. package/dist/chains/evm/hub/types/account.d.ts +23 -0
  111. package/dist/chains/evm/hub/types/account.js +2 -0
  112. package/dist/chains/evm/hub/types/account.js.map +1 -0
  113. package/dist/chains/evm/hub/types/chain.d.ts +20 -0
  114. package/dist/chains/evm/hub/types/chain.js +2 -0
  115. package/dist/chains/evm/hub/types/chain.js.map +1 -0
  116. package/dist/chains/evm/hub/types/loan.d.ts +148 -0
  117. package/dist/chains/evm/hub/types/loan.js +9 -0
  118. package/dist/chains/evm/hub/types/loan.js.map +1 -0
  119. package/dist/chains/evm/hub/types/oracle.d.ts +19 -0
  120. package/dist/chains/evm/hub/types/oracle.js +2 -0
  121. package/dist/chains/evm/hub/types/oracle.js.map +1 -0
  122. package/dist/chains/evm/hub/types/pool.d.ts +66 -0
  123. package/dist/chains/evm/hub/types/pool.js +2 -0
  124. package/dist/chains/evm/hub/types/pool.js.map +1 -0
  125. package/dist/chains/evm/hub/types/token.d.ts +9 -0
  126. package/dist/chains/evm/hub/types/token.js +2 -0
  127. package/dist/chains/evm/hub/types/token.js.map +1 -0
  128. package/dist/chains/evm/hub/utils/chain.d.ts +15 -0
  129. package/dist/chains/evm/hub/utils/chain.js +37 -0
  130. package/dist/chains/evm/hub/utils/chain.js.map +1 -0
  131. package/dist/chains/evm/hub/utils/contract.d.ts +26 -0
  132. package/dist/chains/evm/hub/utils/contract.js +76 -0
  133. package/dist/chains/evm/hub/utils/contract.js.map +1 -0
  134. package/dist/chains/evm/hub/utils/events.d.ts +23 -0
  135. package/dist/chains/evm/hub/utils/events.js +100 -0
  136. package/dist/chains/evm/hub/utils/events.js.map +1 -0
  137. package/dist/chains/evm/hub/utils/loan.d.ts +4 -0
  138. package/dist/chains/evm/hub/utils/loan.js +37 -0
  139. package/dist/chains/evm/hub/utils/loan.js.map +1 -0
  140. package/dist/chains/evm/spoke/constants/abi/bridge-router-spoke-abi.d.ts +1044 -0
  141. package/dist/chains/evm/spoke/constants/abi/bridge-router-spoke-abi.js +806 -0
  142. package/dist/chains/evm/spoke/constants/abi/bridge-router-spoke-abi.js.map +1 -0
  143. package/dist/chains/evm/spoke/constants/abi/spoke-common-abi.d.ts +1152 -0
  144. package/dist/chains/evm/spoke/constants/abi/spoke-common-abi.js +735 -0
  145. package/dist/chains/evm/spoke/constants/abi/spoke-common-abi.js.map +1 -0
  146. package/dist/chains/evm/spoke/constants/abi/spoke-rewards-v2-common-abi.d.ts +697 -0
  147. package/dist/chains/evm/spoke/constants/abi/spoke-rewards-v2-common-abi.js +501 -0
  148. package/dist/chains/evm/spoke/constants/abi/spoke-rewards-v2-common-abi.js.map +1 -0
  149. package/dist/chains/evm/spoke/constants/abi/spoke-token-abi.d.ts +986 -0
  150. package/dist/chains/evm/spoke/constants/abi/spoke-token-abi.js +705 -0
  151. package/dist/chains/evm/spoke/constants/abi/spoke-token-abi.js.map +1 -0
  152. package/dist/chains/evm/spoke/modules/index.d.ts +3 -0
  153. package/dist/chains/evm/spoke/modules/index.js +4 -0
  154. package/dist/chains/evm/spoke/modules/index.js.map +1 -0
  155. package/dist/chains/evm/spoke/modules/ts-evm-account.d.ts +18 -0
  156. package/dist/chains/evm/spoke/modules/ts-evm-account.js +141 -0
  157. package/dist/chains/evm/spoke/modules/ts-evm-account.js.map +1 -0
  158. package/dist/chains/evm/spoke/modules/ts-evm-gmp.d.ts +20 -0
  159. package/dist/chains/evm/spoke/modules/ts-evm-gmp.js +163 -0
  160. package/dist/chains/evm/spoke/modules/ts-evm-gmp.js.map +1 -0
  161. package/dist/chains/evm/spoke/modules/ts-evm-loan.d.ts +38 -0
  162. package/dist/chains/evm/spoke/modules/ts-evm-loan.js +461 -0
  163. package/dist/chains/evm/spoke/modules/ts-evm-loan.js.map +1 -0
  164. package/dist/chains/evm/spoke/types/pool.d.ts +7 -0
  165. package/dist/chains/evm/spoke/types/pool.js +2 -0
  166. package/dist/chains/evm/spoke/types/pool.js.map +1 -0
  167. package/dist/chains/evm/spoke/utils/contract.d.ts +18 -0
  168. package/dist/chains/evm/spoke/utils/contract.js +46 -0
  169. package/dist/chains/evm/spoke/utils/contract.js.map +1 -0
  170. package/dist/common/constants/adapter.d.ts +2 -0
  171. package/dist/common/constants/adapter.js +6 -0
  172. package/dist/common/constants/adapter.js.map +1 -0
  173. package/dist/common/constants/byte.d.ts +6 -0
  174. package/dist/common/constants/byte.js +7 -0
  175. package/dist/common/constants/byte.js.map +1 -0
  176. package/dist/common/constants/chain.d.ts +10 -0
  177. package/dist/common/constants/chain.js +224 -0
  178. package/dist/common/constants/chain.js.map +1 -0
  179. package/dist/common/constants/gmp.d.ts +3 -0
  180. package/dist/common/constants/gmp.js +10 -0
  181. package/dist/common/constants/gmp.js.map +1 -0
  182. package/dist/common/constants/lending.d.ts +2 -0
  183. package/dist/common/constants/lending.js +4 -0
  184. package/dist/common/constants/lending.js.map +1 -0
  185. package/dist/common/constants/message.d.ts +9 -0
  186. package/dist/common/constants/message.js +23 -0
  187. package/dist/common/constants/message.js.map +1 -0
  188. package/dist/common/constants/pool.d.ts +14 -0
  189. package/dist/common/constants/pool.js +24 -0
  190. package/dist/common/constants/pool.js.map +1 -0
  191. package/dist/common/types/adapter.d.ts +30 -0
  192. package/dist/common/types/adapter.js +7 -0
  193. package/dist/common/types/adapter.js.map +1 -0
  194. package/dist/common/types/address.d.ts +9 -0
  195. package/dist/common/types/address.js +2 -0
  196. package/dist/common/types/address.js.map +1 -0
  197. package/dist/common/types/brand.d.ts +6 -0
  198. package/dist/common/types/brand.js +2 -0
  199. package/dist/common/types/brand.js.map +1 -0
  200. package/dist/common/types/chain.d.ts +29 -0
  201. package/dist/common/types/chain.js +9 -0
  202. package/dist/common/types/chain.js.map +1 -0
  203. package/dist/common/types/core.d.ts +28 -0
  204. package/dist/common/types/core.js +2 -0
  205. package/dist/common/types/core.js.map +1 -0
  206. package/dist/common/types/gmp.d.ts +15 -0
  207. package/dist/common/types/gmp.js +6 -0
  208. package/dist/common/types/gmp.js.map +1 -0
  209. package/dist/common/types/lending.d.ts +20 -0
  210. package/dist/common/types/lending.js +13 -0
  211. package/dist/common/types/lending.js.map +1 -0
  212. package/dist/common/types/message.d.ts +280 -0
  213. package/dist/common/types/message.js +32 -0
  214. package/dist/common/types/message.js.map +1 -0
  215. package/dist/common/types/module.d.ts +20 -0
  216. package/dist/common/types/module.js +2 -0
  217. package/dist/common/types/module.js.map +1 -0
  218. package/dist/common/types/token.d.ts +49 -0
  219. package/dist/common/types/token.js +24 -0
  220. package/dist/common/types/token.js.map +1 -0
  221. package/dist/common/utils/adapter.d.ts +17 -0
  222. package/dist/common/utils/adapter.js +98 -0
  223. package/dist/common/utils/adapter.js.map +1 -0
  224. package/dist/common/utils/address.d.ts +6 -0
  225. package/dist/common/utils/address.js +32 -0
  226. package/dist/common/utils/address.js.map +1 -0
  227. package/dist/common/utils/bytes.d.ts +6 -0
  228. package/dist/common/utils/bytes.js +25 -0
  229. package/dist/common/utils/bytes.js.map +1 -0
  230. package/dist/common/utils/chain.d.ts +20 -0
  231. package/dist/common/utils/chain.js +79 -0
  232. package/dist/common/utils/chain.js.map +1 -0
  233. package/dist/common/utils/formulae.d.ts +19 -0
  234. package/dist/common/utils/formulae.js +118 -0
  235. package/dist/common/utils/formulae.js.map +1 -0
  236. package/dist/common/utils/gmp.d.ts +3 -0
  237. package/dist/common/utils/gmp.js +5 -0
  238. package/dist/common/utils/gmp.js.map +1 -0
  239. package/dist/common/utils/lending.d.ts +7 -0
  240. package/dist/common/utils/lending.js +16 -0
  241. package/dist/common/utils/lending.js.map +1 -0
  242. package/dist/common/utils/math-lib.d.ts +10 -0
  243. package/dist/common/utils/math-lib.js +41 -0
  244. package/dist/common/utils/math-lib.js.map +1 -0
  245. package/dist/common/utils/messages.d.ts +16 -0
  246. package/dist/common/utils/messages.js +124 -0
  247. package/dist/common/utils/messages.js.map +1 -0
  248. package/dist/common/utils/token.d.ts +3 -0
  249. package/dist/common/utils/token.js +8 -0
  250. package/dist/common/utils/token.js.map +1 -0
  251. package/dist/common/utils/transaction.d.ts +4 -0
  252. package/dist/common/utils/transaction.js +18 -0
  253. package/dist/common/utils/transaction.js.map +1 -0
  254. package/dist/index.d.ts +38 -0
  255. package/dist/index.js +50 -0
  256. package/dist/index.js.map +1 -0
  257. package/dist/lifeline/core/ts-core.d.ts +24 -0
  258. package/dist/lifeline/core/ts-core.js +101 -0
  259. package/dist/lifeline/core/ts-core.js.map +1 -0
  260. package/dist/lifeline/modules/index.d.ts +5 -0
  261. package/dist/lifeline/modules/index.js +6 -0
  262. package/dist/lifeline/modules/index.js.map +1 -0
  263. package/dist/lifeline/modules/ts-account.d.ts +23 -0
  264. package/dist/lifeline/modules/ts-account.js +205 -0
  265. package/dist/lifeline/modules/ts-account.js.map +1 -0
  266. package/dist/lifeline/modules/ts-gmp.d.ts +3 -0
  267. package/dist/lifeline/modules/ts-gmp.js +4 -0
  268. package/dist/lifeline/modules/ts-gmp.js.map +1 -0
  269. package/dist/lifeline/modules/ts-loan.d.ts +48 -0
  270. package/dist/lifeline/modules/ts-loan.js +580 -0
  271. package/dist/lifeline/modules/ts-loan.js.map +1 -0
  272. package/dist/lifeline/modules/ts-oracle.d.ts +8 -0
  273. package/dist/lifeline/modules/ts-oracle.js +27 -0
  274. package/dist/lifeline/modules/ts-oracle.js.map +1 -0
  275. package/dist/lifeline/modules/ts-pool.d.ts +5 -0
  276. package/dist/lifeline/modules/ts-pool.js +8 -0
  277. package/dist/lifeline/modules/ts-pool.js.map +1 -0
  278. package/dist/types/generics.d.ts +1 -0
  279. package/dist/types/generics.js +2 -0
  280. package/dist/types/generics.js.map +1 -0
  281. package/dist/utils/address.d.ts +1 -0
  282. package/dist/utils/address.js +2 -0
  283. package/dist/utils/address.js.map +1 -0
  284. package/dist/utils/array.d.ts +3 -0
  285. package/dist/utils/array.js +7 -0
  286. package/dist/utils/array.js.map +1 -0
  287. package/dist/utils/exhaustive-check.d.ts +1 -0
  288. package/dist/utils/exhaustive-check.js +4 -0
  289. package/dist/utils/exhaustive-check.js.map +1 -0
  290. package/dist/utils/random.d.ts +1 -0
  291. package/dist/utils/random.js +4 -0
  292. package/dist/utils/random.js.map +1 -0
  293. package/package.json +56 -0
  294. package/src/chains/evm/common/constant/abi/arbitrum-node-interface-abi.ts +17 -0
  295. package/src/chains/evm/common/constant/abi/bridge-router-abi.ts +793 -0
  296. package/src/chains/evm/common/constant/abi/ccip-data-adapter-abi.ts +621 -0
  297. package/src/chains/evm/common/constant/abi/erc-20-abi.ts +156 -0
  298. package/src/chains/evm/common/constant/abi/wormhole-data-adapter-abi.ts +644 -0
  299. package/src/chains/evm/common/constant/abi/wormhole-relayer-abi.ts +500 -0
  300. package/src/chains/evm/common/constant/chain.ts +88 -0
  301. package/src/chains/evm/common/constant/contract.ts +15 -0
  302. package/src/chains/evm/common/constant/tokens.ts +33 -0
  303. package/src/chains/evm/common/types/chain.ts +26 -0
  304. package/src/chains/evm/common/types/contract.ts +17 -0
  305. package/src/chains/evm/common/types/gmp.ts +43 -0
  306. package/src/chains/evm/common/types/module.ts +115 -0
  307. package/src/chains/evm/common/types/token.ts +35 -0
  308. package/src/chains/evm/common/utils/chain.ts +33 -0
  309. package/src/chains/evm/common/utils/contract.ts +120 -0
  310. package/src/chains/evm/common/utils/gmp.ts +54 -0
  311. package/src/chains/evm/common/utils/message.ts +648 -0
  312. package/src/chains/evm/common/utils/provider.ts +38 -0
  313. package/src/chains/evm/common/utils/tokens.ts +102 -0
  314. package/src/chains/evm/hub/constants/abi/account-manager-abi.ts +708 -0
  315. package/src/chains/evm/hub/constants/abi/bridge-router-hub-abi.ts +815 -0
  316. package/src/chains/evm/hub/constants/abi/hub-abi.ts +228 -0
  317. package/src/chains/evm/hub/constants/abi/hub-pool-abi.ts +1557 -0
  318. package/src/chains/evm/hub/constants/abi/hub-rewards-v1-abi.ts +648 -0
  319. package/src/chains/evm/hub/constants/abi/hub-rewards-v2-abi.ts +889 -0
  320. package/src/chains/evm/hub/constants/abi/loan-manager-abi.ts +1054 -0
  321. package/src/chains/evm/hub/constants/abi/node-manager-abi.ts +227 -0
  322. package/src/chains/evm/hub/constants/abi/oracle-manager-abi.ts +390 -0
  323. package/src/chains/evm/hub/constants/chain.ts +305 -0
  324. package/src/chains/evm/hub/modules/index.ts +5 -0
  325. package/src/chains/evm/hub/modules/ts-hub-account.ts +117 -0
  326. package/src/chains/evm/hub/modules/ts-hub-gmp.ts +231 -0
  327. package/src/chains/evm/hub/modules/ts-hub-loan.ts +915 -0
  328. package/src/chains/evm/hub/modules/ts-hub-oracle.ts +131 -0
  329. package/src/chains/evm/hub/modules/ts-hub-pool.ts +241 -0
  330. package/src/chains/evm/hub/types/account.ts +30 -0
  331. package/src/chains/evm/hub/types/chain.ts +22 -0
  332. package/src/chains/evm/hub/types/loan.ts +188 -0
  333. package/src/chains/evm/hub/types/oracle.ts +25 -0
  334. package/src/chains/evm/hub/types/pool.ts +75 -0
  335. package/src/chains/evm/hub/types/token.ts +10 -0
  336. package/src/chains/evm/hub/utils/chain.ts +78 -0
  337. package/src/chains/evm/hub/utils/contract.ts +178 -0
  338. package/src/chains/evm/hub/utils/events.ts +160 -0
  339. package/src/chains/evm/hub/utils/loan.ts +72 -0
  340. package/src/chains/evm/spoke/constants/abi/bridge-router-spoke-abi.ts +805 -0
  341. package/src/chains/evm/spoke/constants/abi/spoke-common-abi.ts +734 -0
  342. package/src/chains/evm/spoke/constants/abi/spoke-rewards-v2-common-abi.ts +500 -0
  343. package/src/chains/evm/spoke/constants/abi/spoke-token-abi.ts +704 -0
  344. package/src/chains/evm/spoke/modules/index.ts +3 -0
  345. package/src/chains/evm/spoke/modules/ts-evm-account.ts +341 -0
  346. package/src/chains/evm/spoke/modules/ts-evm-gmp.ts +353 -0
  347. package/src/chains/evm/spoke/modules/ts-evm-loan.ts +1032 -0
  348. package/src/chains/evm/spoke/types/pool.ts +7 -0
  349. package/src/chains/evm/spoke/utils/contract.ts +123 -0
  350. package/src/common/constants/adapter.ts +6 -0
  351. package/src/common/constants/byte.ts +7 -0
  352. package/src/common/constants/chain.ts +319 -0
  353. package/src/common/constants/gmp.ts +19 -0
  354. package/src/common/constants/lending.ts +9 -0
  355. package/src/common/constants/message.ts +25 -0
  356. package/src/common/constants/pool.ts +30 -0
  357. package/src/common/types/adapter.ts +44 -0
  358. package/src/common/types/address.ts +11 -0
  359. package/src/common/types/brand.ts +3 -0
  360. package/src/common/types/chain.ts +42 -0
  361. package/src/common/types/core.ts +31 -0
  362. package/src/common/types/gmp.ts +19 -0
  363. package/src/common/types/lending.ts +26 -0
  364. package/src/common/types/message.ts +401 -0
  365. package/src/common/types/module.ts +46 -0
  366. package/src/common/types/token.ts +72 -0
  367. package/src/common/utils/adapter.ts +197 -0
  368. package/src/common/utils/address.ts +50 -0
  369. package/src/common/utils/bytes.ts +36 -0
  370. package/src/common/utils/chain.ts +163 -0
  371. package/src/common/utils/formulae.ts +270 -0
  372. package/src/common/utils/gmp.ts +8 -0
  373. package/src/common/utils/lending.ts +31 -0
  374. package/src/common/utils/math-lib.ts +50 -0
  375. package/src/common/utils/messages.ts +283 -0
  376. package/src/common/utils/token.ts +13 -0
  377. package/src/common/utils/transaction.ts +27 -0
  378. package/src/index.ts +73 -0
  379. package/src/lifeline/core/ts-core.ts +136 -0
  380. package/src/lifeline/modules/index.ts +5 -0
  381. package/src/lifeline/modules/ts-account.ts +420 -0
  382. package/src/lifeline/modules/ts-gmp.ts +5 -0
  383. package/src/lifeline/modules/ts-loan.ts +1268 -0
  384. package/src/lifeline/modules/ts-oracle.ts +68 -0
  385. package/src/lifeline/modules/ts-pool.ts +19 -0
  386. package/src/types/generics.ts +1 -0
  387. package/src/utils/address.ts +0 -0
  388. package/src/utils/array.ts +11 -0
  389. package/src/utils/exhaustive-check.ts +3 -0
  390. package/src/utils/random.ts +3 -0
@@ -0,0 +1,1055 @@
1
+ export const LoanControllerAbi = [
2
+ {
3
+ type: 'constructor',
4
+ inputs: [
5
+ { name: 'admin', type: 'address', internalType: 'address' },
6
+ {
7
+ name: 'priceFeedManager',
8
+ type: 'address',
9
+ internalType: 'contract IPriceFeedManager',
10
+ },
11
+ ],
12
+ stateMutability: 'nonpayable',
13
+ },
14
+ {
15
+ type: 'function',
16
+ name: 'DEFAULT_ADMIN_ROLE',
17
+ inputs: [],
18
+ outputs: [{ name: '', type: 'bytes32', internalType: 'bytes32' }],
19
+ stateMutability: 'view',
20
+ },
21
+ {
22
+ type: 'function',
23
+ name: 'HUB_ROLE',
24
+ inputs: [],
25
+ outputs: [{ name: '', type: 'bytes32', internalType: 'bytes32' }],
26
+ stateMutability: 'view',
27
+ },
28
+ {
29
+ type: 'function',
30
+ name: 'LISTING_ROLE',
31
+ inputs: [],
32
+ outputs: [{ name: '', type: 'bytes32', internalType: 'bytes32' }],
33
+ stateMutability: 'view',
34
+ },
35
+ {
36
+ type: 'function',
37
+ name: 'ORACLE_ROLE',
38
+ inputs: [],
39
+ outputs: [{ name: '', type: 'bytes32', internalType: 'bytes32' }],
40
+ stateMutability: 'view',
41
+ },
42
+ {
43
+ type: 'function',
44
+ name: 'REBALANCER_ROLE',
45
+ inputs: [],
46
+ outputs: [{ name: '', type: 'bytes32', internalType: 'bytes32' }],
47
+ stateMutability: 'view',
48
+ },
49
+ {
50
+ type: 'function',
51
+ name: 'acceptDefaultAdminTransfer',
52
+ inputs: [],
53
+ outputs: [],
54
+ stateMutability: 'nonpayable',
55
+ },
56
+ {
57
+ type: 'function',
58
+ name: 'addPool',
59
+ inputs: [
60
+ { name: 'pool', type: 'address', internalType: 'contract IAssetHubPool' },
61
+ ],
62
+ outputs: [],
63
+ stateMutability: 'nonpayable',
64
+ },
65
+ {
66
+ type: 'function',
67
+ name: 'beginDefaultAdminTransfer',
68
+ inputs: [{ name: 'newAdmin', type: 'address', internalType: 'address' }],
69
+ outputs: [],
70
+ stateMutability: 'nonpayable',
71
+ },
72
+ {
73
+ type: 'function',
74
+ name: 'borrow',
75
+ inputs: [
76
+ { name: 'loanId', type: 'bytes32', internalType: 'bytes32' },
77
+ { name: 'accountId', type: 'bytes32', internalType: 'bytes32' },
78
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
79
+ { name: 'amount', type: 'uint256', internalType: 'uint256' },
80
+ { name: 'maxStableRate', type: 'uint256', internalType: 'uint256' },
81
+ ],
82
+ outputs: [],
83
+ stateMutability: 'nonpayable',
84
+ },
85
+ {
86
+ type: 'function',
87
+ name: 'cancelDefaultAdminTransfer',
88
+ inputs: [],
89
+ outputs: [],
90
+ stateMutability: 'nonpayable',
91
+ },
92
+ {
93
+ type: 'function',
94
+ name: 'changeBorrowMode',
95
+ inputs: [
96
+ { name: 'loanId', type: 'bytes32', internalType: 'bytes32' },
97
+ { name: 'accountId', type: 'bytes32', internalType: 'bytes32' },
98
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
99
+ { name: 'maxStableRate', type: 'uint256', internalType: 'uint256' },
100
+ ],
101
+ outputs: [],
102
+ stateMutability: 'nonpayable',
103
+ },
104
+ {
105
+ type: 'function',
106
+ name: 'changeDefaultAdminDelay',
107
+ inputs: [{ name: 'newDelay', type: 'uint48', internalType: 'uint48' }],
108
+ outputs: [],
109
+ stateMutability: 'nonpayable',
110
+ },
111
+ {
112
+ type: 'function',
113
+ name: 'createLoanType',
114
+ inputs: [
115
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
116
+ { name: 'loanTargetHealth', type: 'uint32', internalType: 'uint32' },
117
+ ],
118
+ outputs: [],
119
+ stateMutability: 'nonpayable',
120
+ },
121
+ {
122
+ type: 'function',
123
+ name: 'decreaseBorrowBalance',
124
+ inputs: [
125
+ { name: 'loanId', type: 'bytes32', internalType: 'bytes32' },
126
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
127
+ ],
128
+ outputs: [],
129
+ stateMutability: 'nonpayable',
130
+ },
131
+ {
132
+ type: 'function',
133
+ name: 'defaultAdmin',
134
+ inputs: [],
135
+ outputs: [{ name: '', type: 'address', internalType: 'address' }],
136
+ stateMutability: 'view',
137
+ },
138
+ {
139
+ type: 'function',
140
+ name: 'defaultAdminDelay',
141
+ inputs: [],
142
+ outputs: [{ name: '', type: 'uint48', internalType: 'uint48' }],
143
+ stateMutability: 'view',
144
+ },
145
+ {
146
+ type: 'function',
147
+ name: 'defaultAdminDelayIncreaseWait',
148
+ inputs: [],
149
+ outputs: [{ name: '', type: 'uint48', internalType: 'uint48' }],
150
+ stateMutability: 'view',
151
+ },
152
+ {
153
+ type: 'function',
154
+ name: 'deleteUserLoanAccount',
155
+ inputs: [
156
+ { name: 'loanId', type: 'bytes32', internalType: 'bytes32' },
157
+ { name: 'accountId', type: 'bytes32', internalType: 'bytes32' },
158
+ ],
159
+ outputs: [],
160
+ stateMutability: 'nonpayable',
161
+ },
162
+ {
163
+ type: 'function',
164
+ name: 'deposit',
165
+ inputs: [
166
+ { name: 'loanId', type: 'bytes32', internalType: 'bytes32' },
167
+ { name: 'accountId', type: 'bytes32', internalType: 'bytes32' },
168
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
169
+ { name: 'amount', type: 'uint256', internalType: 'uint256' },
170
+ ],
171
+ outputs: [],
172
+ stateMutability: 'nonpayable',
173
+ },
174
+ {
175
+ type: 'function',
176
+ name: 'depositTsToken',
177
+ inputs: [
178
+ { name: 'loanId', type: 'bytes32', internalType: 'bytes32' },
179
+ { name: 'accountId', type: 'bytes32', internalType: 'bytes32' },
180
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
181
+ { name: 'sender', type: 'address', internalType: 'address' },
182
+ { name: 'fAmount', type: 'uint256', internalType: 'uint256' },
183
+ ],
184
+ outputs: [],
185
+ stateMutability: 'nonpayable',
186
+ },
187
+ {
188
+ type: 'function',
189
+ name: 'deprecateLoanType',
190
+ inputs: [{ name: 'loanTypeId', type: 'uint16', internalType: 'uint16' }],
191
+ outputs: [],
192
+ stateMutability: 'nonpayable',
193
+ },
194
+ {
195
+ type: 'function',
196
+ name: 'deprecatePoolInLoanType',
197
+ inputs: [
198
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
199
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
200
+ ],
201
+ outputs: [],
202
+ stateMutability: 'nonpayable',
203
+ },
204
+ {
205
+ type: 'function',
206
+ name: 'getLoanPool',
207
+ inputs: [
208
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
209
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
210
+ ],
211
+ outputs: [
212
+ {
213
+ name: '',
214
+ type: 'tuple',
215
+ internalType: 'struct LoanControllerState.LoanPool',
216
+ components: [
217
+ { name: 'collateralUsed', type: 'uint256', internalType: 'uint256' },
218
+ { name: 'borrowUsed', type: 'uint256', internalType: 'uint256' },
219
+ { name: 'collateralCap', type: 'uint64', internalType: 'uint64' },
220
+ { name: 'borrowCap', type: 'uint64', internalType: 'uint64' },
221
+ { name: 'collateralFactor', type: 'uint16', internalType: 'uint16' },
222
+ { name: 'borrowFactor', type: 'uint16', internalType: 'uint16' },
223
+ { name: 'liquidationBonus', type: 'uint16', internalType: 'uint16' },
224
+ { name: 'liquidationFee', type: 'uint16', internalType: 'uint16' },
225
+ { name: 'isAdded', type: 'bool', internalType: 'bool' },
226
+ { name: 'isDeprecated', type: 'bool', internalType: 'bool' },
227
+ {
228
+ name: 'reward',
229
+ type: 'tuple',
230
+ internalType: 'struct LoanControllerState.LoanPoolReward',
231
+ components: [
232
+ {
233
+ name: 'lastUpdateTimestamp',
234
+ type: 'uint64',
235
+ internalType: 'uint64',
236
+ },
237
+ {
238
+ name: 'minimumAmount',
239
+ type: 'uint256',
240
+ internalType: 'uint256',
241
+ },
242
+ {
243
+ name: 'collateralSpeed',
244
+ type: 'uint256',
245
+ internalType: 'uint256',
246
+ },
247
+ { name: 'borrowSpeed', type: 'uint256', internalType: 'uint256' },
248
+ {
249
+ name: 'collateralRewardIndex',
250
+ type: 'uint256',
251
+ internalType: 'uint256',
252
+ },
253
+ {
254
+ name: 'borrowRewardIndex',
255
+ type: 'uint256',
256
+ internalType: 'uint256',
257
+ },
258
+ ],
259
+ },
260
+ ],
261
+ },
262
+ ],
263
+ stateMutability: 'view',
264
+ },
265
+ {
266
+ type: 'function',
267
+ name: 'getLoanTypeLoanTargetHealth',
268
+ inputs: [{ name: 'loanTypeId', type: 'uint16', internalType: 'uint16' }],
269
+ outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],
270
+ stateMutability: 'view',
271
+ },
272
+ {
273
+ type: 'function',
274
+ name: 'getPool',
275
+ inputs: [{ name: 'poolId', type: 'uint8', internalType: 'uint8' }],
276
+ outputs: [
277
+ { name: '', type: 'address', internalType: 'contract IAssetHubPool' },
278
+ ],
279
+ stateMutability: 'view',
280
+ },
281
+ {
282
+ type: 'function',
283
+ name: 'getPriceFeedManager',
284
+ inputs: [],
285
+ outputs: [{ name: '', type: 'address', internalType: 'address' }],
286
+ stateMutability: 'view',
287
+ },
288
+ {
289
+ type: 'function',
290
+ name: 'getRoleAdmin',
291
+ inputs: [{ name: 'role', type: 'bytes32', internalType: 'bytes32' }],
292
+ outputs: [{ name: '', type: 'bytes32', internalType: 'bytes32' }],
293
+ stateMutability: 'view',
294
+ },
295
+ {
296
+ type: 'function',
297
+ name: 'getType',
298
+ inputs: [{ name: 'loanId', type: 'bytes32', internalType: 'bytes32' }],
299
+ outputs: [{ name: '', type: 'uint16', internalType: 'uint16' }],
300
+ stateMutability: 'view',
301
+ },
302
+ {
303
+ type: 'function',
304
+ name: 'getUserPoolRewards',
305
+ inputs: [
306
+ { name: 'accountId', type: 'bytes32', internalType: 'bytes32' },
307
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
308
+ ],
309
+ outputs: [
310
+ {
311
+ name: '',
312
+ type: 'tuple',
313
+ internalType: 'struct LoanControllerState.UserPoolRewards',
314
+ components: [
315
+ { name: 'collateral', type: 'uint256', internalType: 'uint256' },
316
+ { name: 'borrow', type: 'uint256', internalType: 'uint256' },
317
+ { name: 'interestPaid', type: 'uint256', internalType: 'uint256' },
318
+ ],
319
+ },
320
+ ],
321
+ stateMutability: 'view',
322
+ },
323
+ {
324
+ type: 'function',
325
+ name: 'grantRole',
326
+ inputs: [
327
+ { name: 'role', type: 'bytes32', internalType: 'bytes32' },
328
+ { name: 'account', type: 'address', internalType: 'address' },
329
+ ],
330
+ outputs: [],
331
+ stateMutability: 'nonpayable',
332
+ },
333
+ {
334
+ type: 'function',
335
+ name: 'hasRole',
336
+ inputs: [
337
+ { name: 'role', type: 'bytes32', internalType: 'bytes32' },
338
+ { name: 'account', type: 'address', internalType: 'address' },
339
+ ],
340
+ outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
341
+ stateMutability: 'view',
342
+ },
343
+ {
344
+ type: 'function',
345
+ name: 'increaseBorrowBalance',
346
+ inputs: [
347
+ { name: 'loanId', type: 'bytes32', internalType: 'bytes32' },
348
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
349
+ ],
350
+ outputs: [],
351
+ stateMutability: 'nonpayable',
352
+ },
353
+ {
354
+ type: 'function',
355
+ name: 'initiateLoanAccount',
356
+ inputs: [
357
+ { name: 'nonce', type: 'bytes4', internalType: 'bytes4' },
358
+ { name: 'accountId', type: 'bytes32', internalType: 'bytes32' },
359
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
360
+ { name: 'loanName', type: 'bytes32', internalType: 'bytes32' },
361
+ ],
362
+ outputs: [{ name: 'loanId', type: 'bytes32', internalType: 'bytes32' }],
363
+ stateMutability: 'nonpayable',
364
+ },
365
+ {
366
+ type: 'function',
367
+ name: 'isLoanTypeCreated',
368
+ inputs: [{ name: 'loanTypeId', type: 'uint16', internalType: 'uint16' }],
369
+ outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
370
+ stateMutability: 'view',
371
+ },
372
+ {
373
+ type: 'function',
374
+ name: 'isLoanTypeDeprecated',
375
+ inputs: [{ name: 'loanTypeId', type: 'uint16', internalType: 'uint16' }],
376
+ outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
377
+ stateMutability: 'view',
378
+ },
379
+ {
380
+ type: 'function',
381
+ name: 'isPoolAdded',
382
+ inputs: [{ name: 'poolId', type: 'uint8', internalType: 'uint8' }],
383
+ outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
384
+ stateMutability: 'view',
385
+ },
386
+ {
387
+ type: 'function',
388
+ name: 'isPoolInLoanType',
389
+ inputs: [
390
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
391
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
392
+ ],
393
+ outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
394
+ stateMutability: 'view',
395
+ },
396
+ {
397
+ type: 'function',
398
+ name: 'isPoolInLoanTypeDeprecated',
399
+ inputs: [
400
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
401
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
402
+ ],
403
+ outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
404
+ stateMutability: 'view',
405
+ },
406
+ {
407
+ type: 'function',
408
+ name: 'isUserLoanActive',
409
+ inputs: [{ name: 'loanId', type: 'bytes32', internalType: 'bytes32' }],
410
+ outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
411
+ stateMutability: 'view',
412
+ },
413
+ {
414
+ type: 'function',
415
+ name: 'isUserLoanOwner',
416
+ inputs: [
417
+ { name: 'loanId', type: 'bytes32', internalType: 'bytes32' },
418
+ { name: 'accountId', type: 'bytes32', internalType: 'bytes32' },
419
+ ],
420
+ outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
421
+ stateMutability: 'view',
422
+ },
423
+ {
424
+ type: 'function',
425
+ name: 'linkPoolToLoanType',
426
+ inputs: [
427
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
428
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
429
+ { name: 'collateralFactor', type: 'uint16', internalType: 'uint16' },
430
+ { name: 'collateralCap', type: 'uint64', internalType: 'uint64' },
431
+ { name: 'borrowFactor', type: 'uint16', internalType: 'uint16' },
432
+ { name: 'borrowCap', type: 'uint64', internalType: 'uint64' },
433
+ { name: 'liquidationBonus', type: 'uint16', internalType: 'uint16' },
434
+ { name: 'liquidationFee', type: 'uint16', internalType: 'uint16' },
435
+ {
436
+ name: 'rewardCollateralSpeed',
437
+ type: 'uint256',
438
+ internalType: 'uint256',
439
+ },
440
+ { name: 'rewardBorrowSpeed', type: 'uint256', internalType: 'uint256' },
441
+ { name: 'rewardMinimumAmount', type: 'uint256', internalType: 'uint256' },
442
+ ],
443
+ outputs: [],
444
+ stateMutability: 'nonpayable',
445
+ },
446
+ {
447
+ type: 'function',
448
+ name: 'liquidate',
449
+ inputs: [
450
+ { name: 'violatorLoanId', type: 'bytes32', internalType: 'bytes32' },
451
+ { name: 'liquidatorLoanId', type: 'bytes32', internalType: 'bytes32' },
452
+ { name: 'liquidatorAccountId', type: 'bytes32', internalType: 'bytes32' },
453
+ { name: 'colPoolId', type: 'uint8', internalType: 'uint8' },
454
+ { name: 'borPoolId', type: 'uint8', internalType: 'uint8' },
455
+ { name: 'maxRepayAmount', type: 'uint256', internalType: 'uint256' },
456
+ { name: 'minSeizedAmount', type: 'uint256', internalType: 'uint256' },
457
+ ],
458
+ outputs: [],
459
+ stateMutability: 'nonpayable',
460
+ },
461
+ {
462
+ type: 'function',
463
+ name: 'owner',
464
+ inputs: [],
465
+ outputs: [{ name: '', type: 'address', internalType: 'address' }],
466
+ stateMutability: 'view',
467
+ },
468
+ {
469
+ type: 'function',
470
+ name: 'pendingDefaultAdmin',
471
+ inputs: [],
472
+ outputs: [
473
+ { name: 'newAdmin', type: 'address', internalType: 'address' },
474
+ { name: 'schedule', type: 'uint48', internalType: 'uint48' },
475
+ ],
476
+ stateMutability: 'view',
477
+ },
478
+ {
479
+ type: 'function',
480
+ name: 'pendingDefaultAdminDelay',
481
+ inputs: [],
482
+ outputs: [
483
+ { name: 'newDelay', type: 'uint48', internalType: 'uint48' },
484
+ { name: 'schedule', type: 'uint48', internalType: 'uint48' },
485
+ ],
486
+ stateMutability: 'view',
487
+ },
488
+ {
489
+ type: 'function',
490
+ name: 'refreshPoolRewardIndexes',
491
+ inputs: [
492
+ { name: 'loanTypeIds', type: 'uint16[]', internalType: 'uint16[]' },
493
+ {
494
+ name: 'poolIdsForLoanType',
495
+ type: 'uint8[][]',
496
+ internalType: 'uint8[][]',
497
+ },
498
+ ],
499
+ outputs: [],
500
+ stateMutability: 'nonpayable',
501
+ },
502
+ {
503
+ type: 'function',
504
+ name: 'renounceRole',
505
+ inputs: [
506
+ { name: 'role', type: 'bytes32', internalType: 'bytes32' },
507
+ { name: 'account', type: 'address', internalType: 'address' },
508
+ ],
509
+ outputs: [],
510
+ stateMutability: 'nonpayable',
511
+ },
512
+ {
513
+ type: 'function',
514
+ name: 'repay',
515
+ inputs: [
516
+ { name: 'loanId', type: 'bytes32', internalType: 'bytes32' },
517
+ { name: 'accountId', type: 'bytes32', internalType: 'bytes32' },
518
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
519
+ { name: 'amount', type: 'uint256', internalType: 'uint256' },
520
+ { name: 'maxOverRepayment', type: 'uint256', internalType: 'uint256' },
521
+ ],
522
+ outputs: [],
523
+ stateMutability: 'nonpayable',
524
+ },
525
+ {
526
+ type: 'function',
527
+ name: 'repayWithCollateral',
528
+ inputs: [
529
+ { name: 'loanId', type: 'bytes32', internalType: 'bytes32' },
530
+ { name: 'accountId', type: 'bytes32', internalType: 'bytes32' },
531
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
532
+ { name: 'amount', type: 'uint256', internalType: 'uint256' },
533
+ ],
534
+ outputs: [],
535
+ stateMutability: 'nonpayable',
536
+ },
537
+ {
538
+ type: 'function',
539
+ name: 'retrieveUserLoan',
540
+ inputs: [{ name: 'loanId', type: 'bytes32', internalType: 'bytes32' }],
541
+ outputs: [
542
+ { name: 'accountId', type: 'bytes32', internalType: 'bytes32' },
543
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
544
+ { name: 'colPools', type: 'uint8[]', internalType: 'uint8[]' },
545
+ { name: 'borPools', type: 'uint8[]', internalType: 'uint8[]' },
546
+ {
547
+ name: '',
548
+ type: 'tuple[]',
549
+ internalType: 'struct LoanControllerState.UserLoanCollateral[]',
550
+ components: [
551
+ { name: 'balance', type: 'uint256', internalType: 'uint256' },
552
+ { name: 'rewardIndex', type: 'uint256', internalType: 'uint256' },
553
+ ],
554
+ },
555
+ {
556
+ name: '',
557
+ type: 'tuple[]',
558
+ internalType: 'struct LoanControllerState.UserLoanBorrow[]',
559
+ components: [
560
+ { name: 'amount', type: 'uint256', internalType: 'uint256' },
561
+ { name: 'balance', type: 'uint256', internalType: 'uint256' },
562
+ {
563
+ name: 'lastInterestIndex',
564
+ type: 'uint256',
565
+ internalType: 'uint256',
566
+ },
567
+ {
568
+ name: 'stableInterestRate',
569
+ type: 'uint256',
570
+ internalType: 'uint256',
571
+ },
572
+ {
573
+ name: 'lastStableUpdateTimestamp',
574
+ type: 'uint256',
575
+ internalType: 'uint256',
576
+ },
577
+ { name: 'rewardIndex', type: 'uint256', internalType: 'uint256' },
578
+ ],
579
+ },
580
+ ],
581
+ stateMutability: 'view',
582
+ },
583
+ {
584
+ type: 'function',
585
+ name: 'revokeRole',
586
+ inputs: [
587
+ { name: 'role', type: 'bytes32', internalType: 'bytes32' },
588
+ { name: 'account', type: 'address', internalType: 'address' },
589
+ ],
590
+ outputs: [],
591
+ stateMutability: 'nonpayable',
592
+ },
593
+ {
594
+ type: 'function',
595
+ name: 'rollbackDefaultAdminDelay',
596
+ inputs: [],
597
+ outputs: [],
598
+ stateMutability: 'nonpayable',
599
+ },
600
+ {
601
+ type: 'function',
602
+ name: 'supportsInterface',
603
+ inputs: [{ name: 'interfaceId', type: 'bytes4', internalType: 'bytes4' }],
604
+ outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
605
+ stateMutability: 'view',
606
+ },
607
+ {
608
+ type: 'function',
609
+ name: 'syncLoanTypeHealthMetric',
610
+ inputs: [
611
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
612
+ { name: 'loanTargetHealth', type: 'uint32', internalType: 'uint32' },
613
+ ],
614
+ outputs: [],
615
+ stateMutability: 'nonpayable',
616
+ },
617
+ {
618
+ type: 'function',
619
+ name: 'syncUserLoanRewards',
620
+ inputs: [{ name: 'loanIds', type: 'bytes32[]', internalType: 'bytes32[]' }],
621
+ outputs: [],
622
+ stateMutability: 'nonpayable',
623
+ },
624
+ {
625
+ type: 'function',
626
+ name: 'updateLoanPoolBorrowFactor',
627
+ inputs: [
628
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
629
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
630
+ { name: 'borrowFactor', type: 'uint16', internalType: 'uint16' },
631
+ ],
632
+ outputs: [],
633
+ stateMutability: 'nonpayable',
634
+ },
635
+ {
636
+ type: 'function',
637
+ name: 'updateLoanPoolCaps',
638
+ inputs: [
639
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
640
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
641
+ { name: 'collateralCap', type: 'uint64', internalType: 'uint64' },
642
+ { name: 'borrowCap', type: 'uint64', internalType: 'uint64' },
643
+ ],
644
+ outputs: [],
645
+ stateMutability: 'nonpayable',
646
+ },
647
+ {
648
+ type: 'function',
649
+ name: 'updateLoanPoolCollateralFactor',
650
+ inputs: [
651
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
652
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
653
+ { name: 'collateralFactor', type: 'uint16', internalType: 'uint16' },
654
+ ],
655
+ outputs: [],
656
+ stateMutability: 'nonpayable',
657
+ },
658
+ {
659
+ type: 'function',
660
+ name: 'updateLoanPoolLiquidation',
661
+ inputs: [
662
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
663
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
664
+ { name: 'liquidationBonus', type: 'uint16', internalType: 'uint16' },
665
+ { name: 'liquidationFee', type: 'uint16', internalType: 'uint16' },
666
+ ],
667
+ outputs: [],
668
+ stateMutability: 'nonpayable',
669
+ },
670
+ {
671
+ type: 'function',
672
+ name: 'updatePriceFeedManager',
673
+ inputs: [
674
+ {
675
+ name: 'newPriceFeedManager',
676
+ type: 'address',
677
+ internalType: 'contract IPriceFeedManager',
678
+ },
679
+ ],
680
+ outputs: [],
681
+ stateMutability: 'nonpayable',
682
+ },
683
+ {
684
+ type: 'function',
685
+ name: 'updateRewardParams',
686
+ inputs: [
687
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
688
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
689
+ { name: 'collateralSpeed', type: 'uint256', internalType: 'uint256' },
690
+ { name: 'borrowSpeed', type: 'uint256', internalType: 'uint256' },
691
+ { name: 'minimumAmount', type: 'uint256', internalType: 'uint256' },
692
+ ],
693
+ outputs: [],
694
+ stateMutability: 'nonpayable',
695
+ },
696
+ {
697
+ type: 'function',
698
+ name: 'withdraw',
699
+ inputs: [
700
+ { name: 'loanId', type: 'bytes32', internalType: 'bytes32' },
701
+ { name: 'accountId', type: 'bytes32', internalType: 'bytes32' },
702
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
703
+ { name: 'amount', type: 'uint256', internalType: 'uint256' },
704
+ { name: 'isFAmount', type: 'bool', internalType: 'bool' },
705
+ ],
706
+ outputs: [
707
+ { name: 'underlingAmount', type: 'uint256', internalType: 'uint256' },
708
+ ],
709
+ stateMutability: 'nonpayable',
710
+ },
711
+ {
712
+ type: 'function',
713
+ name: 'withdrawTsToken',
714
+ inputs: [
715
+ { name: 'loanId', type: 'bytes32', internalType: 'bytes32' },
716
+ { name: 'accountId', type: 'bytes32', internalType: 'bytes32' },
717
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
718
+ { name: 'recipient', type: 'address', internalType: 'address' },
719
+ { name: 'fAmount', type: 'uint256', internalType: 'uint256' },
720
+ ],
721
+ outputs: [],
722
+ stateMutability: 'nonpayable',
723
+ },
724
+ {
725
+ type: 'event',
726
+ name: 'DefaultAdminDelayChangeCanceled',
727
+ inputs: [],
728
+ anonymous: false,
729
+ },
730
+ {
731
+ type: 'event',
732
+ name: 'DefaultAdminDelayChangeScheduled',
733
+ inputs: [
734
+ {
735
+ name: 'newDelay',
736
+ type: 'uint48',
737
+ indexed: false,
738
+ internalType: 'uint48',
739
+ },
740
+ {
741
+ name: 'effectSchedule',
742
+ type: 'uint48',
743
+ indexed: false,
744
+ internalType: 'uint48',
745
+ },
746
+ ],
747
+ anonymous: false,
748
+ },
749
+ {
750
+ type: 'event',
751
+ name: 'DefaultAdminTransferCanceled',
752
+ inputs: [],
753
+ anonymous: false,
754
+ },
755
+ {
756
+ type: 'event',
757
+ name: 'DefaultAdminTransferScheduled',
758
+ inputs: [
759
+ {
760
+ name: 'newAdmin',
761
+ type: 'address',
762
+ indexed: true,
763
+ internalType: 'address',
764
+ },
765
+ {
766
+ name: 'acceptSchedule',
767
+ type: 'uint48',
768
+ indexed: false,
769
+ internalType: 'uint48',
770
+ },
771
+ ],
772
+ anonymous: false,
773
+ },
774
+ {
775
+ type: 'event',
776
+ name: 'DeleteUserLoanAccount',
777
+ inputs: [
778
+ {
779
+ name: 'loanId',
780
+ type: 'bytes32',
781
+ indexed: false,
782
+ internalType: 'bytes32',
783
+ },
784
+ {
785
+ name: 'accountId',
786
+ type: 'bytes32',
787
+ indexed: true,
788
+ internalType: 'bytes32',
789
+ },
790
+ ],
791
+ anonymous: false,
792
+ },
793
+ {
794
+ type: 'event',
795
+ name: 'InitiateLoanAccount',
796
+ inputs: [
797
+ {
798
+ name: 'loanId',
799
+ type: 'bytes32',
800
+ indexed: false,
801
+ internalType: 'bytes32',
802
+ },
803
+ {
804
+ name: 'accountId',
805
+ type: 'bytes32',
806
+ indexed: true,
807
+ internalType: 'bytes32',
808
+ },
809
+ {
810
+ name: 'loanTypeId',
811
+ type: 'uint16',
812
+ indexed: false,
813
+ internalType: 'uint16',
814
+ },
815
+ {
816
+ name: 'loanName',
817
+ type: 'bytes32',
818
+ indexed: false,
819
+ internalType: 'bytes32',
820
+ },
821
+ ],
822
+ anonymous: false,
823
+ },
824
+ {
825
+ type: 'event',
826
+ name: 'RewardIndexesUpdated',
827
+ inputs: [
828
+ { name: 'poolId', type: 'uint8', indexed: false, internalType: 'uint8' },
829
+ {
830
+ name: 'collateralRewardIndex',
831
+ type: 'uint256',
832
+ indexed: false,
833
+ internalType: 'uint256',
834
+ },
835
+ {
836
+ name: 'borrowRewardIndex',
837
+ type: 'uint256',
838
+ indexed: false,
839
+ internalType: 'uint256',
840
+ },
841
+ {
842
+ name: 'lastUpdateTimestamp',
843
+ type: 'uint256',
844
+ indexed: false,
845
+ internalType: 'uint256',
846
+ },
847
+ ],
848
+ anonymous: false,
849
+ },
850
+ {
851
+ type: 'event',
852
+ name: 'RoleAdminChanged',
853
+ inputs: [
854
+ { name: 'role', type: 'bytes32', indexed: true, internalType: 'bytes32' },
855
+ {
856
+ name: 'previousAdminRole',
857
+ type: 'bytes32',
858
+ indexed: true,
859
+ internalType: 'bytes32',
860
+ },
861
+ {
862
+ name: 'newAdminRole',
863
+ type: 'bytes32',
864
+ indexed: true,
865
+ internalType: 'bytes32',
866
+ },
867
+ ],
868
+ anonymous: false,
869
+ },
870
+ {
871
+ type: 'event',
872
+ name: 'RoleGranted',
873
+ inputs: [
874
+ { name: 'role', type: 'bytes32', indexed: true, internalType: 'bytes32' },
875
+ {
876
+ name: 'account',
877
+ type: 'address',
878
+ indexed: true,
879
+ internalType: 'address',
880
+ },
881
+ {
882
+ name: 'sender',
883
+ type: 'address',
884
+ indexed: true,
885
+ internalType: 'address',
886
+ },
887
+ ],
888
+ anonymous: false,
889
+ },
890
+ {
891
+ type: 'event',
892
+ name: 'RoleRevoked',
893
+ inputs: [
894
+ { name: 'role', type: 'bytes32', indexed: true, internalType: 'bytes32' },
895
+ {
896
+ name: 'account',
897
+ type: 'address',
898
+ indexed: true,
899
+ internalType: 'address',
900
+ },
901
+ {
902
+ name: 'sender',
903
+ type: 'address',
904
+ indexed: true,
905
+ internalType: 'address',
906
+ },
907
+ ],
908
+ anonymous: false,
909
+ },
910
+ { type: 'error', name: 'AccessControlBadConfirmation', inputs: [] },
911
+ {
912
+ type: 'error',
913
+ name: 'AccessControlEnforcedDefaultAdminDelay',
914
+ inputs: [{ name: 'schedule', type: 'uint48', internalType: 'uint48' }],
915
+ },
916
+ { type: 'error', name: 'AccessControlEnforcedDefaultAdminRules', inputs: [] },
917
+ {
918
+ type: 'error',
919
+ name: 'AccessControlInvalidDefaultAdmin',
920
+ inputs: [
921
+ { name: 'defaultAdmin', type: 'address', internalType: 'address' },
922
+ ],
923
+ },
924
+ {
925
+ type: 'error',
926
+ name: 'AccessControlUnauthorizedAccount',
927
+ inputs: [
928
+ { name: 'account', type: 'address', internalType: 'address' },
929
+ { name: 'neededRole', type: 'bytes32', internalType: 'bytes32' },
930
+ ],
931
+ },
932
+ {
933
+ type: 'error',
934
+ name: 'BorrowCapReached',
935
+ inputs: [{ name: 'poolId', type: 'uint8', internalType: 'uint8' }],
936
+ },
937
+ { type: 'error', name: 'BorrowFactorTooLow', inputs: [] },
938
+ { type: 'error', name: 'BorrowRewardIndexTooHigh', inputs: [] },
939
+ {
940
+ type: 'error',
941
+ name: 'CollateralCapReached',
942
+ inputs: [{ name: 'poolId', type: 'uint8', internalType: 'uint8' }],
943
+ },
944
+ { type: 'error', name: 'CollateralFactorTooHigh', inputs: [] },
945
+ { type: 'error', name: 'CollateralRewardIndexTooHigh', inputs: [] },
946
+ { type: 'error', name: 'LiquidationBonusTooHigh', inputs: [] },
947
+ { type: 'error', name: 'LiquidationFeeTooHigh', inputs: [] },
948
+ {
949
+ type: 'error',
950
+ name: 'LoanNotEmpty',
951
+ inputs: [{ name: 'loanId', type: 'bytes32', internalType: 'bytes32' }],
952
+ },
953
+ {
954
+ type: 'error',
955
+ name: 'LoanPoolAlreadyAdded',
956
+ inputs: [
957
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
958
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
959
+ ],
960
+ },
961
+ {
962
+ type: 'error',
963
+ name: 'LoanPoolAlreadyDeprecated',
964
+ inputs: [
965
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
966
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
967
+ ],
968
+ },
969
+ {
970
+ type: 'error',
971
+ name: 'LoanPoolDeprecated',
972
+ inputs: [
973
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
974
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
975
+ ],
976
+ },
977
+ {
978
+ type: 'error',
979
+ name: 'LoanPoolUnknown',
980
+ inputs: [
981
+ { name: 'loanTypeId', type: 'uint16', internalType: 'uint16' },
982
+ { name: 'poolId', type: 'uint8', internalType: 'uint8' },
983
+ ],
984
+ },
985
+ { type: 'error', name: 'LoanTargetHealthTooLow', inputs: [] },
986
+ {
987
+ type: 'error',
988
+ name: 'LoanTypeAlreadyCreated',
989
+ inputs: [{ name: 'loanTypeId', type: 'uint16', internalType: 'uint16' }],
990
+ },
991
+ {
992
+ type: 'error',
993
+ name: 'LoanTypeAlreadyDeprecated',
994
+ inputs: [{ name: 'loanTypeId', type: 'uint16', internalType: 'uint16' }],
995
+ },
996
+ {
997
+ type: 'error',
998
+ name: 'LoanTypeDeprecated',
999
+ inputs: [{ name: 'loanTypeId', type: 'uint16', internalType: 'uint16' }],
1000
+ },
1001
+ {
1002
+ type: 'error',
1003
+ name: 'LoanTypeUnknown',
1004
+ inputs: [{ name: 'loanTypeId', type: 'uint16', internalType: 'uint16' }],
1005
+ },
1006
+ { type: 'error', name: 'MathOverflowedMulDiv', inputs: [] },
1007
+ {
1008
+ type: 'error',
1009
+ name: 'NotAccountOwner',
1010
+ inputs: [
1011
+ { name: 'loanId', type: 'bytes32', internalType: 'bytes32' },
1012
+ { name: 'accountId', type: 'bytes32', internalType: 'bytes32' },
1013
+ ],
1014
+ },
1015
+ {
1016
+ type: 'error',
1017
+ name: 'PoolAlreadyAdded',
1018
+ inputs: [{ name: 'poolId', type: 'uint8', internalType: 'uint8' }],
1019
+ },
1020
+ {
1021
+ type: 'error',
1022
+ name: 'PoolUnknown',
1023
+ inputs: [{ name: 'poolId', type: 'uint8', internalType: 'uint8' }],
1024
+ },
1025
+ { type: 'error', name: 'ReentrancyGuardReentrantCall', inputs: [] },
1026
+ {
1027
+ type: 'error',
1028
+ name: 'SafeCastOverflowedUintDowncast',
1029
+ inputs: [
1030
+ { name: 'bits', type: 'uint8', internalType: 'uint8' },
1031
+ { name: 'value', type: 'uint256', internalType: 'uint256' },
1032
+ ],
1033
+ },
1034
+ {
1035
+ type: 'error',
1036
+ name: 'SameLoan',
1037
+ inputs: [{ name: 'loanId', type: 'bytes32', internalType: 'bytes32' }],
1038
+ },
1039
+ {
1040
+ type: 'error',
1041
+ name: 'UnknownUserLoan',
1042
+ inputs: [{ name: 'loanId', type: 'bytes32', internalType: 'bytes32' }],
1043
+ },
1044
+ {
1045
+ type: 'error',
1046
+ name: 'UserLoanAlreadyCreated',
1047
+ inputs: [{ name: 'loanId', type: 'bytes32', internalType: 'bytes32' }],
1048
+ },
1049
+ {
1050
+ type: 'error',
1051
+ name: 'UserLoanInactive',
1052
+ inputs: [{ name: 'loanId', type: 'bytes32', internalType: 'bytes32' }],
1053
+ },
1054
+ ];
1055
+ //# sourceMappingURL=loan-manager-abi.js.map