@aurigami/sdk 1.6.7 → 1.6.9
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.
- package/dist/SDK.d.ts +1 -0
- package/dist/abis/index.d.ts +3 -2
- package/dist/consts/index.d.ts +2 -1
- package/dist/consts/symbols.d.ts +1 -0
- package/dist/contracts/misc.d.ts +3 -0
- package/dist/entities/auriEnv.d.ts +2 -1
- package/dist/helpers/helpers.d.ts +1 -0
- package/dist/sdk.cjs.development.js +207 -49
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +214 -58
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/index.d.ts +5 -0
- package/package.json +3 -3
- package/src/SDK.ts +8 -12
- package/src/abis/index.ts +4 -2
- package/src/consts/constants.ts +2 -1
- package/src/consts/index.ts +2 -1
- package/src/consts/symbols.ts +5 -0
- package/src/contracts/misc.ts +51 -1
- package/src/entities/auriEnv.ts +14 -1
- package/src/helpers/helpers.ts +7 -0
- package/src/types/index.ts +6 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("bignumber.js")),r=require("ethers"),n=require("ethers/lib/utils"),o=e(require("@aurigami/contracts/deployments/aurora_mainnet.json")),a=e(require("@aurigami/contracts/deployments/aurora_testnet.json")),i=e(require("@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json")),u=e(require("@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json")),s=e(require("@aurigami/contracts/artifacts/contracts/AuriAirdrop.sol/AuriAirdrop.json")),c=e(require("@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json")),p=e(require("@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json")),f=e(require("@aurigami/contracts/artifacts/contracts/AuriOracle.sol/AuriOracle.json")),l=e(require("@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json")),d=e(require("@aurigami/contracts/artifacts/contracts/EthRepayHelper.sol/EthRepayHelper.json")),h=e(require("@aurigami/contracts/artifacts/contracts/interfaces/EIP20Interface.sol/EIP20Interface.json")),w=e(require("@aurigami/contracts/artifacts/contracts/mock/IUniswapV2Pair.sol/IUniswapV2Pair.json")),m=e(require("@aurigami/contracts/artifacts/contracts/mock/Multicall2.sol/Multicall2.json")),v=e(require("@aurigami/contracts/artifacts/contracts/mock/UltilizationHelper.sol/UltilizationHelper.json")),y=e(require("@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json")),b=e(require("@aurigami/contracts/artifacts/contracts/ReferralDirectory.sol/ReferralDirectory.json")),g=require("@ethersproject/abstract-signer"),k=e(require("axios")),x=e(require("@aurigami/contracts/artifacts/contracts/AuToken.sol/AuToken.json")),A="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",E={auTokens:[{name:"auUSDC",address:o.auTokens.USDC.toLowerCase(),underlying:"0xb12bfca5a55806aaf64e99521918a4bf0fc40802".toLowerCase()},{name:"auETH",address:o.auTokens.ETH.toLowerCase(),underlying:A.toLowerCase()},{name:"auWBTC",address:o.auTokens.WBTC.toLowerCase(),underlying:"0xf4eb217ba2454613b15dbdea6e5f22276410e89e".toLowerCase()},{name:"auUSDT",address:o.auTokens.USDT.toLowerCase(),underlying:"0x4988a896b1227218e4a686fde5eabdcabd91571f".toLowerCase()},{name:"auDAI",address:o.auTokens.DAI.toLowerCase(),underlying:"0xe3520349f477a5f6eb06107066048508498a291b".toLowerCase()},{name:"auWNEAR",address:o.auTokens.WNEAR.toLowerCase(),underlying:"0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d".toLowerCase()},{name:"auSTNEAR",address:o.auTokens.STNEAR.toLowerCase(),underlying:"0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30".toLowerCase()},{name:"auAURORA",address:o.auTokens.AURORA.toLowerCase(),underlying:"0x8bec47865ade3b172a928df8f990bc7f2a3b9f79".toLowerCase()},{name:"auTRI",address:o.auTokens.TRI.toLowerCase(),underlying:"0xFa94348467f64D5A457F75F8bc40495D33c65aBB".toLowerCase()},{name:"auPLY",address:o.auTokens.PLY.toLowerCase(),underlying:"0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f".toLowerCase()},{name:"auUSN",address:o.auTokens.USN.toLowerCase(),underlying:"0x5183e1b1091804bc2602586919e6880ac1cf2896".toLowerCase()}],misc:{COMPTROLLER:o.comptroller.toLowerCase(),oracle:o.oracle.toLowerCase(),AURIFAIRLAUNCH:o.fairLaunch.toLowerCase(),AURILENS:o.auriLens.toLowerCase(),ETHREPAYHELPER:o.ethRepayHelper.toLowerCase(),AURI_AIRDROP:o.auriAirdrop.toLowerCase(),MULTICALL:o.multicall.toLowerCase(),TEAM_MULTISIG:"0x2D05FfFE70CE64c5954710D4C308dB31C8dBd8dE".toLowerCase(),PLY_TOKEN_LOCK:o.plyTokenLock.toLowerCase(),REFERRAL:o.referralDirectory.toLocaleLowerCase()},tokens:{AURORA:"0x8bec47865ade3b172a928df8f990bc7f2a3b9f79".toLowerCase(),PLY:"0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f".toLowerCase(),stNEAR:"0x07f9f7f963c5cd2bbffd30ccfb964be114332e30".toLowerCase(),USDC:"0xb12bfca5a55806aaf64e99521918a4bf0fc40802".toLowerCase(),WNEAR:"0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d".toLowerCase(),TRI:"0xFa94348467f64D5A457F75F8bc40495D33c65aBB".toLowerCase(),META:"0xc21ff01229e982d7c8b8691163b0a3cb8f357453".toLowerCase(),PULP:o.PULP.toLowerCase(),PLYWNEAR:o.ply_wnear_lp.toLowerCase(),USN:"0x5183e1b1091804bc2602586919e6880ac1cf2896".toLowerCase()}},L=new Set([].concat(E.auTokens.map((function(e){return e.underlying})),[E.tokens.AURORA,E.tokens.TRI,E.tokens.META,E.tokens.stNEAR])),C=new t(1),R=["0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f","0x04Ac48711BCdc45b4d223fb021E09DA73c71095e","0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d","0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30","0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79","0xFa94348467f64D5A457F75F8bc40495D33c65aBB"],P=[0],T=r.BigNumber.from(2).pow(256).sub(1),S=Object.fromEntries(Object.entries({"0xb12bfca5a55806aaf64e99521918a4bf0fc40802":"36375","0x4988a896b1227218e4a686fde5eabdcabd91571f":"14550","0xf4eb217ba2454613b15dbdea6e5f22276410e89e":"3638","0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE":"14550","0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d":"3638"}).map((function(e){var t=e[1];return[e[0].toLowerCase(),t]}))),B={},_=Object.fromEntries([[E.tokens.USN.toLowerCase(),"1"]]),N={"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee":18,"0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f":18,"0x3195949f267702723bc614cae037cdc8d1e94786":8,"0xfa94348467f64d5a457f75f8bc40495d33c65abb":18,"0x07f9f7f963c5cd2bbffd30ccfb964be114332e30":24,"0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d":24,"0x6ea6c03061bddce23d4ec60b6e6e880c33d24dca":8,"0xca9511b610ba5fc7e311fdef9ce16050ee4449e9":8,"0x8bec47865ade3b172a928df8f990bc7f2a3b9f79":18,"0xcfb6b0498cb7555e7e21502e0f449bf28760adbb":8,"0x4f0d864b1abf4b701799a0b30b57a22dfeb5917b":8,"0xad5a2437ff55ed7a8cad3b797b3ec7c5a19b1c54":8,"0x4988a896b1227218e4a686fde5eabdcabd91571f":6,"0xb12bfca5a55806aaf64e99521918a4bf0fc40802":6,"0xe3520349f477a5f6eb06107066048508498a291b":18,"0x8888682e24dd4df7b7ff2b91fccb575737e433bf":8,"0xae4fac24dcdae0132c6d04f564dcf059616e9423":8,"0xce4166363e3a584dac84a47bcd3414b43efcdd1c":8,"0xf4eb217ba2454613b15dbdea6e5f22276410e89e":8,"0xc21ff01229e982d7c8b8691163b0a3cb8f357453":24,"0x04ac48711bcdc45b4d223fb021e09da73c71095e":18,"0x044b6b0cd3bb13d2b9057781df4459c66781dce7":18,"0x5183e1b1091804bc2602586919e6880ac1cf2896":18};function D(e,t,r,n,o,a,i){try{var u=e[a](i),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,o)}function O(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){D(a,n,o,i,u,"next",e)}function u(e){D(a,n,o,i,u,"throw",e)}i(void 0)}))}}function U(){return(U=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function I(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function W(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return F(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?F(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var M,j=function(e){this._networkConnection=e},Y=function(e){function t(t){if(!(t.signer instanceof g.Signer))throw Error("Signer is not provided when constructing BlockchainEntityReadWrite");return e.call(this,t)||this}return I(t,e),t}(j),q=function(){function e(){}var t=e.prototype;return t.read=function(e){return new j(e)},t.readWrite=function(e){return new Y(e)},e}(),H=function(e){function t(t){var r;return(r=e.call(this,t)||this).comptroller=r.getContract(E.misc.COMPTROLLER,l.abi),r.auriFairLaunch=r.getContract(E.misc.AURIFAIRLAUNCH,c.abi),r.auriLens=r.getContract(E.misc.AURILENS,p.abi),r.ply=r.getContract(E.tokens.PLY,h.abi),r.pulp=r.getContract(E.tokens.PULP,y.abi),r}return I(t,e),t.prototype.getContract=function(e,t){return new r.Contract(e,t,this._networkConnection.provider)},t}(j),G=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),a=new A(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var u=g(i,r);if(u){if(u===p)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=c(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,a),o}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var p={};function f(){}function l(){}function d(){}var h={};u(h,o,(function(){return this}));var w=Object.getPrototypeOf,m=w&&w(w(E([])));m&&m!==t&&r.call(m,o)&&(h=m);var v=d.prototype=f.prototype=Object.create(h);function y(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var n;this._invoke=function(o,a){function i(){return new t((function(n,i){!function n(o,a,i,u){var s=c(e[o],e,a);if("throw"!==s.type){var p=s.arg,f=p.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,i,u)}),(function(e){n("throw",e,i,u)})):t.resolve(f).then((function(e){p.value=e,i(p)}),(function(e){return n("throw",e,i,u)}))}u(s.arg)}(o,a,n,i)}))}return n=n?n.then(i,i):i()}}function g(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,g(e,t),"throw"===t.method))return p;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,p;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function E(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:L}}function L(){return{value:void 0,done:!0}}return l.prototype=d,u(v,"constructor",d),u(d,"constructor",l),l.displayName=u(d,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===l||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,u(e,i,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},y(b.prototype),u(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new b(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},y(v),u(v,i,"Generator"),u(v,o,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=E,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,p):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(M={exports:{}}),M.exports);function K(e,t,r){return V.apply(this,arguments)}function V(){return(V=O(G.mark((function e(t,r,n){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n&&(n={}),n=U({},n,{module:t,action:r}),e.next=4,k.get("https://api.aurorascan.dev/api?"+new URLSearchParams(n),{headers:{"Content-Type":"application/json"}});case 4:return e.abrupt("return",e.sent.data.result);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function z(e,t){if(void 0===t&&(t=""),!e)throw t="Assertion failed"+(t?": "+t:""),new Error(t)}function Q(e){return JSON.stringify(e,null," ")}function Z(e){return r.BigNumber.from(10).pow(e).toString()}var J=function(e,t){return e.toLowerCase()==t.toLowerCase()},$=function(){return Math.trunc(Date.now()/1e3)};function X(e){try{return r.utils.getAddress(e)}catch(t){throw new Error("Invalid address: "+e)}}function ee(e){var t=e.toLowerCase();return z(null!=N[t],"Decimal not found for "+e),N[t]}function te(e,r,n){return e.isZero()?new t(0):r.lte(0)?e:e.multipliedBy(n).dividedBy(r)}function re(e,t){return ne.apply(this,arguments)}function ne(){return(ne=O(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getBlock(r);case 2:return e.abrupt("return",e.sent.timestamp);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oe(e,t){return ae.apply(this,arguments)}function ae(){return(ae=O(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,K("block","getblocknobytime",{timestamp:r,closest:"before"});case 2:if(e.t0=parseInt(e.sent),e.t0){e.next=8;break}return e.next=7,t.getBlockNumber();case 7:e.t0=e.sent;case 8:return e.abrupt("return",e.t0);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ie(e){}var ue=function(e,t){this.address=e.toLowerCase(),this.decimals=t},se=new ue(E.tokens.PLY,ee(E.tokens.PLY)),ce=new ue(E.tokens.PLYWNEAR,ee(E.tokens.PLYWNEAR)),pe=function(){function e(e,r,n){void 0===n&&(n=!0),this.rawAmnt=n?r:new t(r).times(Z(e.decimals)).toFixed(0),this.token=e}var r=e.prototype;return r.formattedAmount=function(){return new t(this.rawAmnt).div(Z(this.token.decimals)).toString()},r.rawAmount=function(){return this.rawAmnt},e.fromAddressAndAmount=function(t,r,n){return void 0===n&&(n=!0),new e(new ue(t,ee(t)),r,n)},e}(),fe=new ue("0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",6),le=new ue("0x8729438eb15e2c8b576fcc6aecda6a148776c0f5",18),de=new ue("0xE530dC2095Ef5653205CF5ea79F8979a7028065c",18),he=new pe(fe,"123.456",!1),we=new pe(fe,"0"),me=new pe(fe,"456.123",!1),ve=new pe(fe,"1000.123",!1),ye={market:"0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f",depositBalance:me,borrowBalance:we,isCollateral:!0,maxWithdrawableAmount:he,collateralRatio:.5,underlyingPrice:"1"};function be(e){return ge.apply(this,arguments)}function ge(){return(ge=O(G.mark((function e(r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,k.get("https://api.coingecko.com/api/v3/simple/price?ids="+r+"&vs_currencies=usd").then((function(e){return e.data}));case 2:return e.abrupt("return",new t(e.sent[r].usd));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ke(e){return xe.apply(this,arguments)}function xe(){return(xe=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t.toLowerCase(),e.next=e.t0===E.tokens.AURORA?3:e.t0===E.tokens.TRI?4:e.t0===E.tokens.META?5:6;break;case 3:return e.abrupt("return",be("aurora-near"));case 4:return e.abrupt("return",be("trisolaris"));case 5:return e.abrupt("return",be("meta-pool"));case 6:throw Error("Unknown token "+t+" in fetchPriceFromCoingecko");case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ae(e,t){return Ee.apply(this,arguments)}function Ee(){return(Ee=O(G.mark((function e(t,n){var o,a,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=new r.Contract(t,w.abi,n),(a=[]).push(o.token0()),a.push(o.token1()),a.push(o.getReserves()),a.push(o.totalSupply()),e.next=8,Promise.all(a);case 8:return e.abrupt("return",{token0:(i=e.sent)[0],token1:i[1],reserve0:i[2].reserve0,reserve1:i[2].reserve1,totalSupply:i[3]});case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Le(e,t){return Ce.apply(this,arguments)}function Ce(){return(Ce=O(G.mark((function e(r,n){var o,a,i,u;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=function(){return(u=O(G.mark((function e(r){var i,u,s;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r.reserve.isZero()){e.next=2;break}return e.abrupt("return",new t(0));case 2:return e.next=4,Oe(r.address,n);case 4:return i=e.sent,u=ee(r.address),s=i.multipliedBy(r.reserve.toString()).multipliedBy(2),e.abrupt("return",s.multipliedBy(Z(a)).dividedBy(new t(o.totalSupply.toString())).dividedBy(Z(u)));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)},i=function(e){return u.apply(this,arguments)},e.next=4,Ae(r,n);case 4:return o=e.sent,a=ee(r),e.prev=6,e.next=9,i({address:o.token0,reserve:o.reserve0});case 9:return e.abrupt("return",e.sent);case 12:return e.prev=12,e.t0=e.catch(6),e.prev=15,e.next=18,i({address:o.token1,reserve:o.reserve1});case 18:return e.abrupt("return",e.sent);case 21:throw e.prev=21,e.t1=e.catch(15),Error("Unable to fetch price for both tokens of LP "+r);case 25:case"end":return e.stop()}}),e,null,[[6,12],[15,21]])})))).apply(this,arguments)}function Re(e,r){return new t(e.toString()).div(Z(36-r))}function Pe(e,t,r){return Te.apply(this,arguments)}function Te(){return(Te=O(G.mark((function e(t,n,o){var a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=new r.Contract(E.misc.oracle,f.abi,o),e.next=3,a.getUnderlyingPrice(t);case 3:return e.abrupt("return",Re(e.sent,n));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Se(e){return Be.apply(this,arguments)}function Be(){return(Be=O(G.mark((function e(t){var n,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new r.Contract(E.misc.AURILENS,p.abi,t),o=E.auTokens.map((function(e){return e.address})),a=E.auTokens.map((function(e){return ee(e.underlying)})),e.next=5,n.auTokenUnderlyingPriceAll(o);case 5:return e.abrupt("return",e.sent.map((function(e,t){return{auToken:e.auToken,underlyingPrice:Re(e.underlyingPrice,a[t])}})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _e(){return Ne.apply(this,arguments)}function Ne(){return(Ne=O(G.mark((function e(){var r,n,o,a,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=k.get("https://validators.narwallets.com/metrics_json").then((function(e){return e.data})),n=be("near"),e.next=4,Promise.all([r,n]);case 4:return a=(o=e.sent)[1],i=new t(o[0].st_near_price),e.abrupt("return",i.multipliedBy(a));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function De(e){return(e=e.toLowerCase())==E.tokens.AURORA||e==E.tokens.TRI||e==E.tokens.META}function Oe(e,t){return Ue.apply(this,arguments)}function Ue(){return(Ue=O(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(z(L.has(t.toLocaleLowerCase()),"Address "+t+" is not whitelisted for price fetching"),!J(t,E.tokens.stNEAR)){e.next=3;break}return e.abrupt("return",_e());case 3:if(!De(t)){e.next=5;break}return e.abrupt("return",ke(t));case 5:if(void 0===(n=E.auTokens.find((function(e){return J(e.underlying,t)})))){e.next=10;break}return e.abrupt("return",Pe(n.address,ee(t),r));case 10:throw Error("Unable to fetch price for "+t);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ie(e,t){return Fe.apply(this,arguments)}function Fe(){return(Fe=O(G.mark((function e(r,n){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.toLowerCase()in _)){e.next=4;break}return e.abrupt("return",new t(_[r.toLowerCase()]));case 4:if(!J(r,E.tokens.PLYWNEAR)){e.next=8;break}return e.abrupt("return",Le(r,n));case 8:if(!J(r,E.tokens.PLY)){e.next=12;break}return e.abrupt("return",We(n));case 12:if(!J(r,E.tokens.PULP)){e.next=14;break}return e.abrupt("return",je(n));case 14:return e.abrupt("return",Oe(r,n));case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function We(e){return Me.apply(this,arguments)}function Me(){return(Me=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",qe(E.tokens.PLYWNEAR,t));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function je(e){return Ye.apply(this,arguments)}function Ye(){return(Ye=O(G.mark((function e(r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new t(0));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qe(e,t){return He.apply(this,arguments)}function He(){return(He=O(G.mark((function e(r,n){var o,a,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ae(r,n);case 2:if(!(o=e.sent).reserve1.isZero()){e.next=5;break}return e.abrupt("return",new t(0));case 5:return a=ee(o.token0),i=ee(o.token1),e.next=9,Ie(o.token1,n);case 9:return e.abrupt("return",e.sent.multipliedBy(o.reserve1.toString()).multipliedBy(Z(a)).dividedBy(Z(i)).dividedBy(o.reserve0.toString()));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ge(e,t){return Ke.apply(this,arguments)}function Ke(){return(Ke=O(G.mark((function e(r,n){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("0"!=r.rawAmount()){e.next=2;break}return e.abrupt("return",new t(0));case 2:return e.next=4,Ie(r.token.address,n);case 4:return e.abrupt("return",Ve(r,e.sent));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ve(e,r){return new t(e.formattedAmount()).multipliedBy(r)}function ze(e,t){return Qe.apply(this,arguments)}function Qe(){return(Qe=O(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ge(t,r);case 2:return e.abrupt("return",{tokenAmount:t,currencyAmount:{currency:"USD",amount:e.sent.toFixed(10)}});case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ze,Je,$e=function(e){function t(t,n){var o;return(o=e.call(this,n)||this).auToken=new r.Contract(t,x.abi,o._networkConnection.provider),o}I(t,e);var n=t.prototype;return n.queryERC20TransfersOf=function(){var e=O(G.mark((function e(t,r,n){var o,a,i,u=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=[this.auToken.filters.Transfer(t,null),this.auToken.filters.Transfer(null,t)],e.next=3,Promise.all(o.map((function(e){return u.auToken.queryFilter(e,r,n)})));case 3:return a=e.sent.flat(),(i=a.map((function(e){return{from:e.args[0],to:e.args[1],amount:e.args[2],blockNumber:e.blockNumber}}))).sort((function(e,t){return e.blockNumber-t.blockNumber})),e.abrupt("return",i);case 7:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),n.queryERC20BalanceAt=function(){var e=O(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.auToken.balanceOf(t,{blockTag:r+1}));case 1:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t}(j),Xe={__proto__:null,getQuery:K,assert:z,formatObject:Q,decimalFactor:Z,isSameAddress:J,getCurrentTimestamp:$,validateAndParseAddress:X,getDecimal:ee,calcLMRewardApr:te,getBlockTimestamp:re,getBlockBeforeTimestamp:oe,devLog:ie,fetchPriceFromCoingeckoAPI:be,fetchPriceFromCoingecko:ke,fetchLPPositions:Ae,fetchLPPrice:Le,fetchPriceFromOracle:Pe,fetchUnderlyingTokensPrices:Se,fetchStNEARPrice:_e,fetchPrice:Ie,fetchPLYPrice:We,fetchPULPPrice:je,fetchToken0PriceByLP:qe,fetchValuation:Ge,calcValuation:Ve,valuateToken:ze,TransferEventQuery:$e},et=function(e){function t(t){var n;return(n=e.call(this,t)||this).airDrop=new r.Contract(E.misc.AURI_AIRDROP,s.abi,t.provider),n}return I(t,e),t.prototype.getRedeemableReward=function(){var e=O(G.mark((function e(t,n,o){var a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=new ue(n,ee(n)),e.next=3,this.airDrop.getRedeemableReward(r.utils.formatBytes32String(t),n,o);case 3:return e.abrupt("return",new pe(a,e.sent.toString()));case 5:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),t}(j),tt=function(e){function t(){return e.apply(this,arguments)||this}I(t,e);var n=t.prototype;return n.redeemMultiple=function(){var e=O(G.mark((function e(t,n){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return z(t.length==n.length,"campaigns and tokens must have the same length"),e.t0=this.airDrop.connect(this._networkConnection.signer),e.t1=t.map((function(e){return r.utils.formatBytes32String(e)})),e.t2=n,e.next=6,this._networkConnection.signer.getAddress();case 6:return e.t3=e.sent,e.abrupt("return",e.t0.redeem.call(e.t0,e.t1,e.t2,e.t3));case 8:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),n.redeemSingle=function(){var e=O(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.redeemMultiple([t],[r]));case 1:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t}(et),rt=function(e){function t(){return e.call(this)||this}I(t,e);var r=t.prototype;return r.read=function(e){return new et(e)},r.readWrite=function(e){return new tt(e)},t}(q);(Ze=exports.ComptrollerRewardType||(exports.ComptrollerRewardType={}))[Ze.PLY=0]="PLY",Ze[Ze.AURORA=1]="AURORA",(Je=exports.MarketAction||(exports.MarketAction={}))[Je.Deposit=0]="Deposit",Je[Je.Borrow=1]="Borrow",Je[Je.Withdraw=2]="Withdraw",Je[Je.Repay=3]="Repay",Je[Je.EnableCollateral=4]="EnableCollateral",Je[Je.DisableCollateral=5]="DisableCollateral";var nt=function(e){function n(t,n,o){var a;return(a=e.call(this,t)||this).env=new H(t),a.auToken=J(o,A)?new r.Contract(n,u.abi,t.provider):new r.Contract(n,i.abi,t.provider),a.underlying=new ue(o,ee(o)),a}I(n,e);var o=n.prototype;return o.getRewardSpeeds=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriLens.getRewardSpeeds(this.env.comptroller.address,this.auToken.address);case 2:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getTotalTokenBorrowed=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=pe,e.t1=this.underlying,e.next=4,this.auToken.totalBorrows();case 4:return e.t2=e.sent.toString(),e.abrupt("return",new e.t0(e.t1,e.t2));case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getTotalTokenDeposited=function(){var e=O(G.mark((function e(){var t,n,o,a=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(t=[]).push(this.getTotalTokenBorrowed().then((function(e){n=e}))),t.push(this.auToken.getCash().then((function(e){o=new pe(a.underlying,e.toString())}))),e.next=5,Promise.all(t);case 5:return e.abrupt("return",new pe(this.underlying,r.BigNumber.from(o.rawAmount()).add(n.rawAmount()).toString()));case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getDepositAPY=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.auToken.supplyRatePerTimestamp();case 2:return e.abrupt("return",new t(e.sent.toString()).multipliedBy(31536e3).div(Z(18)));case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getBorrowAPY=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.auToken.borrowRatePerTimestamp();case 2:return e.abrupt("return",new t(e.sent.toString()).multipliedBy(31536e3).div(Z(18)));case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getCollateralRatio=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.comptroller.markets(this.auToken.address).then((function(e){return new t(e.collateralFactorMantissa.toString()).div(Z(18))})));case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getBorrowPlyAPY=function(){var e=O(G.mark((function e(){var t,r,n,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(t=[]).push(this.getTotalTokenBorrowed().then((function(e){r=e}))),t.push(this.env.comptroller.rewardSpeeds(exports.ComptrollerRewardType.PLY,this.auToken.address,!1).then((function(e){n=new pe(se,e.toString())}))),t.push(Ie(E.tokens.PLY,this._networkConnection.provider).then((function(e){o=e}))),t.push(Ie(this.underlying.address,this._networkConnection.provider).then((function(e){a=e}))),e.next=7,Promise.all(t);case 7:return e.abrupt("return",te(o.multipliedBy(n.formattedAmount()),a.multipliedBy(r.formattedAmount()),31536e3));case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getDepositPlyAPY=function(){var e=O(G.mark((function e(){var t,r,n,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(t=[]).push(this.getTotalTokenDeposited().then((function(e){r=e}))),t.push(this.env.comptroller.rewardSpeeds(exports.ComptrollerRewardType.PLY,this.auToken.address,!0).then((function(e){n=new pe(se,e.toString())}))),t.push(Ie(E.tokens.PLY,this._networkConnection.provider).then((function(e){o=e}))),t.push(Ie(this.underlying.address,this._networkConnection.provider).then((function(e){a=e}))),e.next=7,Promise.all(t);case 7:return e.abrupt("return",te(o.multipliedBy(n.formattedAmount()),a.multipliedBy(r.formattedAmount()),31536e3));case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getDetails=function(){var e=O(G.mark((function e(){var r,n,o,a,i,u,s,c,p,f,l,d,h,w;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=[]).push(this.getTotalTokenDeposited().then((function(e){n=e}))),r.push(this.getTotalTokenBorrowed().then((function(e){o=e}))),r.push(this.getDepositAPY().then((function(e){a=e.toNumber()}))),r.push(this.getBorrowAPY().then((function(e){i=e.toNumber()}))),r.push(this.getCollateralRatio().then((function(e){u=e.toNumber()}))),r.push(this.getRewardSpeeds().then((function(e){p=e}))),r.push(Ie(E.tokens.PLY,this._networkConnection.provider).then((function(e){s=e}))),r.push(Ie(this.underlying.address,this._networkConnection.provider).then((function(e){c=e}))),e.next=11,Promise.all(r);case 11:return f=te(Ve(new pe(se,p.plyRewardBorrowSpeed.toString()),s),c.multipliedBy(o.formattedAmount()),31536e3),l=te(Ve(new pe(se,p.plyRewardSupplySpeed.toString()),s),c.multipliedBy(n.formattedAmount()),31536e3),e.t0=Xe,e.next=16,Ge(this.getDepositNEARRewardPerWeek(),this._networkConnection.provider);case 16:return e.t1=e.sent,e.t2=c.multipliedBy(n.formattedAmount()),d=e.t0.calcLMRewardApr.call(e.t0,e.t1,e.t2,52),e.t3=Xe,e.next=22,Ge(this.getBorrowNEARRewardPerWeek(),this._networkConnection.provider);case 22:return e.t4=e.sent,e.t5=c.multipliedBy(o.formattedAmount()),h=e.t3.calcLMRewardApr.call(e.t3,e.t4,e.t5,52),w=J(this.underlying.address,E.tokens.stNEAR)?te(new t(5e4),c.multipliedBy(n.formattedAmount()),12):new t(0),e.abrupt("return",{auTokenAddress:this.auToken.address,totalTokenDeposited:n,totalTokenBorrowed:o,depositApy:a,depositPlyApy:l.toNumber(),borrowApy:i,borrowPlyApy:-1*f.toNumber(),collateralRatio:u,depositPlyPerWeek:new pe(se,p.plyRewardSupplySpeed.mul(86400).mul(7).toString()),borrowPlyPerWeek:new pe(se,p.plyRewardBorrowSpeed.mul(86400).mul(7).toString()),depositNEARApy:d.toNumber(),borrowNEARApy:-1*h.toNumber(),depositMETAApy:w.toNumber()});case 27:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getUserBorrowBalance=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.auToken.callStatic.borrowBalanceCurrent(t);case 2:return e.abrupt("return",new pe(this.underlying,e.sent.toString()));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.getUserDepositBalance=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.auToken.callStatic.balanceOfUnderlying(t);case 2:return e.abrupt("return",new pe(this.underlying,e.sent.toString()));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.getDepositNEARRewardPerWeek=function(){var e=new ue(E.tokens.WNEAR,ee(E.tokens.WNEAR)),t=$();if(t<=1651845600&&t>1650636e3){var r,n=null!=(r=S[this.underlying.address.toLocaleLowerCase()])?r:"0";return new pe(e,n,!1)}return new pe(e,"0")},o.getBorrowNEARRewardPerWeek=function(){var e=new ue(E.tokens.WNEAR,ee(E.tokens.WNEAR)),t=$();if(t<=1651845600&&t>1650636e3){var r,n=null!=(r=B[this.underlying.address.toLocaleLowerCase()])?r:"0";return new pe(e,n,!1)}return new pe(e,"0")},n}(j),ot=function(e){function n(t,n,o){var a;return(a=e.call(this,t,n,o)||this)._EthRepayHelper=new r.Contract(E.misc.ETHREPAYHELPER,d.abi,t.provider),a}I(n,e);var o=n.prototype;return o.deposit=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!J(t.token.address,A)){e.next=4;break}return e.abrupt("return",this.auToken.connect(this._networkConnection.signer).mint({value:t.rawAmount()}));case 4:return e.abrupt("return",this.auToken.connect(this._networkConnection.signer).mint(t.rawAmount()));case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.borrow=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.auToken.connect(this._networkConnection.signer).borrow(t.rawAmount()));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.withdraw=function(){var e=O(G.mark((function e(r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!new t(r.rawAmount()).lt(0)){e.next=2;break}return e.abrupt("return",this.auToken.connect(this._networkConnection.signer).redeemUnderlying(T));case 2:return e.abrupt("return",this.auToken.connect(this._networkConnection.signer).redeemUnderlying(r.rawAmount()));case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.repay=function(){var e=O(G.mark((function e(r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!J(r.token.address,A)){e.next=4;break}return e.abrupt("return",this._EthRepayHelper.connect(this._networkConnection.signer).repayBorrow({value:r.rawAmount()}));case 4:if(!new t(r.rawAmount()).lt(0)){e.next=8;break}return e.abrupt("return",this.auToken.connect(this._networkConnection.signer).repayBorrow(T));case 8:return e.abrupt("return",this.auToken.connect(this._networkConnection.signer).repayBorrow(r.rawAmount()));case 9:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.enableCollateral=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.disableCollateral=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),n}(nt),at=function(e){function t(t,r){var n;return(n=e.call(this)||this).address=X(t),n.underlying=X(r),n}I(t,e);var r=t.prototype;return r.read=function(e){return new nt(e,this.address,this.underlying)},r.readWrite=function(e){return new ot(e,this.address,this.underlying)},t}(q),it=function(e){function t(t){var n;return(n=e.call(this,t)||this).multicall=new r.Contract(E.misc.MULTICALL,m.abi,t.provider),n}return I(t,e),t.prototype.aggregate=function(){var e=O(G.mark((function e(t){var n,o,a,i,u,s,c,p;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=[],o=0;case 2:if(!(o<t.length)){e.next=11;break}return i=t[o],e.next=6,(a=i.contract.populateTransaction)[i.method].apply(a,i.args);case 6:n.push({target:(u=e.sent).to,callData:u.data});case 8:o++,e.next=2;break;case 11:return e.next=13,this.multicall.callStatic.aggregate(n);case 13:for(s=e.sent,c=[],p=0;p<t.length;p++)c.push(r.ethers.utils.defaultAbiCoder.decode(t[p].returnTypes,s.returnData[p]));return e.abrupt("return",c);case 17:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(j),ut=r.BigNumber.from(1e4),st=function(e){function n(t){var r;(r=e.call(this,t)||this).env=new H(t);var n=E.tokens.PLY,o=E.tokens.PULP;return r.plyToken=new ue(n,ee(n)),r.pulpToken=new ue(o,ee(o)),r}I(n,e);var o=n.prototype;return o.getPlyBalance=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.ply.balanceOf(t);case 2:return e.abrupt("return",new pe(this.plyToken,e.sent.toString()));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.getPulpBalance=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.pulp.balanceOf(t);case 2:return e.abrupt("return",new pe(this.pulpToken,e.sent.toString()));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.getUnclaimedPlyReward=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriLens.callStatic.claimRewards(this.env.comptroller.address,this.env.auriFairLaunch.address,P,{from:t});case 2:return e.abrupt("return",new pe(this.plyToken,e.sent.plyAccrured.toString()));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.getWeek=function(e){return r.BigNumber.from(e-1651759200).div(604800).toNumber()},o.getLockingDetails=function(){var e=O(G.mark((function e(n){var o,a,i,u,s,c,p,f,l,d,h,w,m;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=this.getWeek($()),(a=[]).push(this.env.auriLens.getPercentLock(this.env.pulp.address,n,o)),a.push(this.env.auriLens.getPercentLock(this.env.pulp.address,n,o+1)),a.push(this.getUnclaimedPlyReward(n)),e.next=7,Promise.all(a);case 7:return u=r.BigNumber.from((i=e.sent)[0]),s=r.BigNumber.from(i[1]),c=i[2],e.next=13,this.env.pulp.calcLockAmount(n,c.rawAmount());case 13:return f=(p=e.sent)[0],l=p[1],d=s.mul(c.rawAmount()).div(ut),h=r.BigNumber.from(c.rawAmount()).sub(d),w=ut.sub(u).toString(),m=ut.sub(s).toString(),e.abrupt("return",{vestingStart:1651759200,currentUnlockPortion:new t(w).dividedBy(100).toNumber(),accruedPly:c,currentPly:new pe(this.plyToken,l.toString()),currentPulp:new pe(this.pulpToken,f.toString()),nextUnlockPortion:new t(m).dividedBy(100).toNumber(),nextPly:new pe(this.plyToken,d.toString()),nextPulp:new pe(this.pulpToken,h.toString())});case 21:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.getTimestampToUnlock=function(){var e=O(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriLens.getWeekToUnlock(this.env.pulp.address,t,100*r);case 2:return e.abrupt("return",1651759200+604800*e.sent.toNumber());case 4:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),o.getNextWeekTimestamp=function(){return 1651759200+604800*(this.getWeek($())+1)},o.getUnlockPortionAt=function(){var e=O(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriLens.getPercentLock(this.env.pulp.address,t,this.getWeek(r));case 2:return n=ut.sub(e.sent),e.abrupt("return",n.toNumber()/100);case 5:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),n}(j),ct=function(e){function t(t){return e.call(this,t)||this}I(t,e);var r=t.prototype;return r.redeem=function(){var e=O(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.pulp.connect(this._networkConnection.signer).redeem(t,r.rawAmount()));case 1:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.selfRedeem=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._networkConnection.signer.getAddress();case 2:return e.abrupt("return",this.redeem(e.sent,t));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(st),pt=function(e){function t(){return e.call(this)||this}I(t,e);var r=t.prototype;return r.read=function(e){return new st(e)},r.readWrite=function(e){return new ct(e)},t}(q),ft=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new H(t),r}I(t,e);var n=t.prototype;return n.getPLYWNEARPoolDetails=function(){var e=O(G.mark((function e(){var t,r,n,o,a,i,u,s,c;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriFairLaunch.getPoolInfo(0).then((function(e){t=e.totalStake,r=e.rewardPerSeconds}));case 2:return n=new pe(ce,t.toString()),e.next=5,Ge(n,this._networkConnection.provider);case 5:for(o=e.sent,a=[],i=0;i<r.length;i++)s=new ue(u=R[i],ee(u)),a.push(Ge(new pe(s,r[i].toString()),this._networkConnection.provider));return c=[],e.next=11,Promise.all(a);case 11:return e.sent.forEach((function(e,t){var r=R[t],n=te(e,o,31536e3).toFixed(10);c.push({address:r,apy:n})})),e.abrupt("return",{totalStakedLiquidity:n,APYs:c});case 13:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),n.stakeBalanceOf=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriFairLaunch.getUserInfo(0,t);case 2:return e.abrupt("return",new pe(ce,e.sent.amount.toString()));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.LpBalanceOf=function(){var e=O(G.mark((function e(t){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new r.Contract(E.tokens.PLYWNEAR,h.abi,this._networkConnection.provider),e.next=3,n.balanceOf(t);case 3:return e.abrupt("return",new pe(ce,e.sent.toString()));case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.unclaimedRewardsOf=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriFairLaunch.callStatic.updateAndGetUserInfo(0,t,{from:t});case 2:return e.abrupt("return",e.sent.unclaimedRewards.map((function(e,t){return pe.fromAddressAndAmount(R[t],e.toString())})));case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(j),lt=function(e){function t(){return e.apply(this,arguments)||this}I(t,e);var n=t.prototype;return n.stake=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.auriFairLaunch.connect(this._networkConnection.signer).deposit(0,t.rawAmount()));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.unstake=function(){var e=O(G.mark((function e(t){var n,o,a,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._networkConnection.signer.getAddress();case 2:return n=e.sent,o=r.BigNumber.from(t.rawAmount()),e.t0=r.BigNumber,e.next=7,this.stakeBalanceOf(n);case 7:return e.t1=e.sent.rawAmount(),a=e.t0.from.call(e.t0,e.t1),i=o.lt(a)?o:a.sub(1),e.abrupt("return",this.env.auriFairLaunch.connect(this._networkConnection.signer).withdraw(0,i));case 11:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(ft),dt=function(e){function t(){return e.call(this)||this}I(t,e);var r=t.prototype;return r.read=function(e){return new ft(e)},r.readWrite=function(e){return new lt(e)},t}(q),ht=function(e){function n(t){var r;return(r=e.call(this,t)||this).stakingRead=new ft(t),r.env=new H(t),r}I(n,e);var o=n.prototype;return o.getUserDetails=function(){var e=O(G.mark((function e(r){var n,o,a,i,u,s,c,p,f,l,d,h,w,m,v,y,b,g,k,x,A,L=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(n=E.auTokens.length,o=[],i=[],u=new t(0),s=[],c=function(){var e=f.value,t={};o.push(t),t.market=e.underlying;var n=new nt(L._networkConnection,e.address,e.underlying);i.push(n.getUserDepositBalance(r).then((function(e){t.depositBalance=e}))),i.push(n.getUserBorrowBalance(r).then((function(e){t.borrowBalance=e}))),i.push(n.getCollateralRatio().then((function(e){t.collateralRatio=e.toNumber()}))),s.push(Ie(n.underlying.address,L._networkConnection.provider).then((function(e){return t.underlyingPrice=e.toString(),e})))},p=W(E.auTokens);!(f=p()).done;)c();return i.push(this.env.comptroller.getAssetsIn(r).then((function(e){a=e}))),e.next=10,Promise.all(i);case 10:return e.next=12,Promise.all(s);case 12:for(l=e.sent,d=[],h=function(){var e=E.auTokens[w];o[w].isCollateral=void 0!==a.find((function(t){return J(e.address,t)})),d.push(Ve(o[w].depositBalance,l[w]))},w=0;w<n;w++)h();return u=d.reduce((function(e,t,r){return o[r].isCollateral?e.plus(t.multipliedBy(o[r].collateralRatio)):e}),new t(0)),e.next=19,this.env.comptroller.getAccountLiquidity(r);case 19:for((m=u.minus(new t(e.sent[0].toString()).div(Z(18)))).lt("0.00001")&&(m=new t(0)),v=u.multipliedBy(C),y=m.div(C),b=v.lte(m)?new t(0):v.minus(m),w=0;w<n;w++)k=new nt(this._networkConnection,(g=E.auTokens[w]).address,g.underlying),x=u.minus(y).gt(0)?u.minus(y):new t(0),A=x.div(o[w].collateralRatio).div(l[w]),o[w].maxWithdrawableAmount=o[w].isCollateral&&A.lt(o[w].depositBalance.formattedAmount())?new pe(k.underlying,A.toFixed(24),!1):new pe(k.underlying,o[w].depositBalance.rawAmount());return e.t0=o,e.t1={currency:"USD",amount:v.toFixed(10)},e.next=30,new st(this._networkConnection).getLockingDetails(r);case 30:return e.t2=e.sent,e.t3={currency:"USD",amount:b.toFixed(10)},e.abrupt("return",{markets:e.t0,borrowLimit:e.t1,userLockingDetails:e.t2,borrowableAmount:e.t3});case 33:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.getTokenPrice=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ie(t.address,this._networkConnection.provider);case 2:return e.abrupt("return",{currency:"USD",amount:e.sent.toFixed(10)});case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.calcHypotheticalStats=function(e){var r=e.userMarketDetail,n=e.currentBorrowValuation,o=e.action,a=e.tokenAmount,i=new t(e.currentBorrowLimit.amount),u=new t(n.amount);switch(o){case exports.MarketAction.EnableCollateral:case exports.MarketAction.DisableCollateral:var s=Ve(r.depositBalance,new t(r.underlyingPrice)).multipliedBy(r.collateralRatio).multipliedBy(C);i=o==exports.MarketAction.EnableCollateral?i.plus(s):i.minus(s);break;case exports.MarketAction.Deposit:case exports.MarketAction.Withdraw:s=Ve(a,new t(r.underlyingPrice)).multipliedBy(r.collateralRatio).multipliedBy(C),i=o==exports.MarketAction.Deposit?i.plus(s):i.minus(s);break;case exports.MarketAction.Borrow:case exports.MarketAction.Repay:var c=Ve(a,new t(r.underlyingPrice));u=o==exports.MarketAction.Borrow?u.plus(c):u.minus(c)}return{newBorrowLimit:{amount:i.toFixed(10),currency:"USD"},newBorrowUtilization:i.eq(0)?u.eq(0)?0:9999.99:u.div(i).toNumber()}},o.getPlyCirculatingSupply=function(){var e=O(G.mark((function e(){var t,n,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new it(this._networkConnection),n={contract:this.env.ply,method:"balanceOf",returnTypes:["uint256"]},e.next=4,t.aggregate([U({},n,{method:"totalSupply",args:[]}),U({},n,{args:[E.misc.TEAM_MULTISIG]}),U({},n,{args:[E.misc.COMPTROLLER]}),U({},n,{args:[E.misc.AURIFAIRLAUNCH]}),U({},n,{args:[E.misc.PLY_TOKEN_LOCK]})]);case 4:return o=e.sent,a=r.BigNumber.from(0),o.forEach((function(e,t){a=0===t?e[0]:a.sub(e[0])})),e.abrupt("return",new pe(se,a.toString()));case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),n}(j),wt=function(e){function t(t){var n;return(n=e.call(this,t)||this).referral=new r.Contract(E.misc.REFERRAL,b.abi,t.provider),n}I(t,e);var n=t.prototype;return n.generateReferralCode=function(){for(var e="abcdefghijklmnopqrstuvwxyz",t=e+e.toUpperCase()+"1234567890",r="",n=0;n<10;n++)r+=t[Math.floor(Math.random()*t.length)];return r},n.getUserReferralCode=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.referral.userReferralCode(t);case 2:return e.abrupt("return",r.ethers.utils.parseBytes32String(e.sent));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.getReferralCodeUsed=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.referral.referralCodeUsed(t);case 2:return e.abrupt("return",r.ethers.utils.parseBytes32String(e.sent));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.getReferralCodeOwner=function(){var e=O(G.mark((function e(t){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.ethers.utils.formatBytes32String(t),e.abrupt("return",this.referral.referralCodeOwner(n));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(j),mt=function(e){function t(){return e.apply(this,arguments)||this}I(t,e);var n=t.prototype;return n.registerNewReferralCode=function(){var e=O(G.mark((function e(){var t;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.ethers.utils.formatBytes32String(this.generateReferralCode()),e.abrupt("return",this.referral.connect(this._networkConnection.signer).registerNewUserReferralCode(t));case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),n.useReferralCode=function(){var e=O(G.mark((function e(t){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.ethers.utils.formatBytes32String(t),e.abrupt("return",this.referral.connect(this._networkConnection.signer).registerReferralCodeUsed(n));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(wt),vt=function(e){function t(){return e.call(this)||this}I(t,e);var r=t.prototype;return r.read=function(e){return new wt(e)},r.readWrite=function(e){return new mt(e)},t}(q),yt=function(e){function n(t){var r;return(r=e.call(this,t)||this).env=new H(t),r._stakingRead=new ft(t),r._misc=new ht(t),r}I(n,e);var o=n.prototype;return o.getUserDetails=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._misc.getUserDetails(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.getPLYWNEARPoolDetails=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._stakingRead.getPLYWNEARPoolDetails());case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getTokenPrice=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._misc.getTokenPrice(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.stakeBalanceOf=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._stakingRead.stakeBalanceOf(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.LpBalanceOf=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._stakingRead.LpBalanceOf(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.unclaimedRewardsOf=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._stakingRead.unclaimedRewardsOf(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.calcHypotheticalStats=function(e){return this._misc.calcHypotheticalStats({userMarketDetail:e.userMarketDetail,currentBorrowLimit:e.currentBorrowLimit,currentBorrowValuation:e.currentBorrowValuation,action:e.action,tokenAmount:e.tokenAmount})},o.getPlyCirculatingSupply=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._misc.getPlyCirculatingSupply());case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getUltilizations=function(){var e=O(G.mark((function e(n){var o,a,i,u;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=new r.Contract(E.misc.ultilizationHelper,v.abi,this._networkConnection.provider),e.next=3,o.getAccountLiquidity(n);case 3:return i=new t((a=e.sent).sumBorrowPlusEffects.toString()),u=new t(a.sumCollateral.toString()),e.abrupt("return",i.dividedBy(u));case 7:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n}(j),bt=function(e){function t(){return e.apply(this,arguments)||this}I(t,e);var r=t.prototype;return r.claim=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=this.env.comptroller.connect(this._networkConnection.signer),e.next=3,this._networkConnection.signer.getAddress();case 3:return e.t1=e.sent,e.abrupt("return",e.t0["claimReward(uint8,address)"].call(e.t0,0,e.t1));case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.claimLpRewards=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=this.env.auriFairLaunch.connect(this._networkConnection.signer),e.next=3,this._networkConnection.signer.getAddress();case 3:return e.t1=e.sent,e.t2=T,e.abrupt("return",e.t0.harvest.call(e.t0,e.t1,0,e.t2));case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.stake=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new lt(this._networkConnection).stake(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.unstake=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new lt(this._networkConnection).unstake(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(yt),gt=function(e){function t(){return e.call(this)||this}I(t,e);var r=t.prototype;return r.read=function(e){return new yt(e)},r.readWrite=function(e){return new bt(e)},t}(q);r.ethers.utils.Logger.setLogLevel(n.Logger.levels.ERROR),t.config({DECIMAL_PLACES:50}),exports.MAINNET_ADDRESSES=o,exports.TESTNET_ADDRESSES=a,exports.AIRDROP_END_TIMESTAMP=1651068e3,exports.AIRDROP_KEEP_THRESHOLD=604800,exports.AIRDROP_START_TIMESTAMP=1649858400,exports.ALL_STAKING_POOLS=P,exports.AURORA_CHAINID=1313161554,exports.Airdrop=rt,exports.AirdropRead=et,exports.AirdropReadWrite=tt,exports.AuriEnv=H,exports.BORROW_LIMIT_BUFFER=C,exports.BORROW_NEAR_REWARDS_PER_WEEK=B,exports.BlockchainEntity=q,exports.BlockchainEntityRead=j,exports.BlockchainEntityReadWrite=Y,exports.DECIMAL_PRECISION=10,exports.DEPOSIT_NEAR_REWARDS_PER_WEEK=S,exports.ETHAddress=A,exports.HARDCODE_PRICE_TOKENS=_,exports.INF=T,exports.MiscRead=ht,exports.MoneyMarket=at,exports.MoneyMarketRead=nt,exports.MoneyMarketReadWrite=ot,exports.ONE_DAY=86400,exports.ONE_WEEK=604800,exports.ONE_YEAR=31536e3,exports.PLYToken=se,exports.PLYWNEARToken=ce,exports.PLYWNEAR_POOL_ID=0,exports.PLYWNEAR_REWARD_TOKENS=R,exports.PRICE_WHITELISTED=L,exports.Papermill=pt,exports.PapermillRead=st,exports.PapermillReadWrite=ct,exports.REWARD_CLAIM_START=1651759200,exports.Referral=vt,exports.ReferralRead=wt,exports.ReferralReadWrite=mt,exports.SDK=gt,exports.SdkRead=yt,exports.SdkReadWrite=bt,exports.Staking=dt,exports.StakingRead=ft,exports.StakingReadWrite=lt,exports.Token=ue,exports.TokenAmount=pe,exports.TransferEventQuery=$e,exports.assert=z,exports.calcLMRewardApr=te,exports.calcValuation=Ve,exports.decimalFactor=Z,exports.decimalRecords=N,exports.devLog=ie,exports.dummyAddress="0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE",exports.dummyMarketAddress="0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f",exports.dummyPly=le,exports.dummyPlyAurora=de,exports.dummyToken=fe,exports.dummyTokenAmount=he,exports.dummyTokenAmount2=me,exports.dummyTokenAmount3=ve,exports.dummyUserMarketDetails=ye,exports.dummyZeroTokenAmount=we,exports.fetchLPPositions=Ae,exports.fetchLPPrice=Le,exports.fetchPLYPrice=We,exports.fetchPULPPrice=je,exports.fetchPrice=Ie,exports.fetchPriceFromCoingecko=ke,exports.fetchPriceFromCoingeckoAPI=be,exports.fetchPriceFromOracle=Pe,exports.fetchStNEARPrice=_e,exports.fetchToken0PriceByLP=qe,exports.fetchUnderlyingTokensPrices=Se,exports.fetchValuation=Ge,exports.formatObject=Q,exports.getBlockBeforeTimestamp=oe,exports.getBlockTimestamp=re,exports.getCurrentTimestamp=$,exports.getDecimal=ee,exports.getQuery=K,exports.isSameAddress=J,exports.networkAddresses=E,exports.validateAndParseAddress=X,exports.valuateToken=ze;
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("bignumber.js")),r=require("ethers"),n=require("ethers/lib/utils"),o=e(require("@aurigami/contracts/deployments/aurora_mainnet.json")),a=e(require("@aurigami/contracts/deployments/aurora_testnet.json")),i=e(require("@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json")),u=e(require("@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json")),s=e(require("@aurigami/contracts/artifacts/contracts/AuriAirdrop.sol/AuriAirdrop.json")),c=e(require("@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json")),p=e(require("@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json")),f=e(require("@aurigami/contracts/artifacts/contracts/AuriOracle.sol/AuriOracle.json")),l=e(require("@aurigami/contracts/artifacts/contracts/AuToken.sol/AuToken.json")),d=e(require("@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json")),h=e(require("@aurigami/contracts/artifacts/contracts/EthRepayHelper.sol/EthRepayHelper.json")),w=e(require("@aurigami/contracts/artifacts/contracts/interfaces/EIP20Interface.sol/EIP20Interface.json")),m=e(require("@aurigami/contracts/artifacts/contracts/mock/AuriInternalLens.sol/AuriInternalLens.json")),v=e(require("@aurigami/contracts/artifacts/contracts/mock/IUniswapV2Pair.sol/IUniswapV2Pair.json")),y=e(require("@aurigami/contracts/artifacts/contracts/mock/Multicall2.sol/Multicall2.json")),b=e(require("@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json")),g=e(require("@aurigami/contracts/artifacts/contracts/ReferralDirectory.sol/ReferralDirectory.json")),k=require("@ethersproject/abstract-signer"),x=e(require("axios")),A="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",L={auTokens:[{name:"auUSDC",address:o.auTokens.USDC.toLowerCase(),underlying:"0xb12bfca5a55806aaf64e99521918a4bf0fc40802".toLowerCase()},{name:"auETH",address:o.auTokens.ETH.toLowerCase(),underlying:A.toLowerCase()},{name:"auWBTC",address:o.auTokens.WBTC.toLowerCase(),underlying:"0xf4eb217ba2454613b15dbdea6e5f22276410e89e".toLowerCase()},{name:"auUSDT",address:o.auTokens.USDT.toLowerCase(),underlying:"0x4988a896b1227218e4a686fde5eabdcabd91571f".toLowerCase()},{name:"auDAI",address:o.auTokens.DAI.toLowerCase(),underlying:"0xe3520349f477a5f6eb06107066048508498a291b".toLowerCase()},{name:"auWNEAR",address:o.auTokens.WNEAR.toLowerCase(),underlying:"0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d".toLowerCase()},{name:"auSTNEAR",address:o.auTokens.STNEAR.toLowerCase(),underlying:"0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30".toLowerCase()},{name:"auAURORA",address:o.auTokens.AURORA.toLowerCase(),underlying:"0x8bec47865ade3b172a928df8f990bc7f2a3b9f79".toLowerCase()},{name:"auTRI",address:o.auTokens.TRI.toLowerCase(),underlying:"0xFa94348467f64D5A457F75F8bc40495D33c65aBB".toLowerCase()},{name:"auPLY",address:o.auTokens.PLY.toLowerCase(),underlying:"0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f".toLowerCase()},{name:"auUSN",address:o.auTokens.USN.toLowerCase(),underlying:"0x5183e1b1091804bc2602586919e6880ac1cf2896".toLowerCase()}],misc:{COMPTROLLER:o.comptroller.toLowerCase(),oracle:o.oracle.toLowerCase(),AURIFAIRLAUNCH:o.fairLaunch.toLowerCase(),AURILENS:o.auriLens.toLowerCase(),ETHREPAYHELPER:o.ethRepayHelper.toLowerCase(),AURI_AIRDROP:o.auriAirdrop.toLowerCase(),MULTICALL:o.multicall.toLowerCase(),TEAM_MULTISIG:"0x2D05FfFE70CE64c5954710D4C308dB31C8dBd8dE".toLowerCase(),PLY_TOKEN_LOCK:o.plyTokenLock.toLowerCase(),REFERRAL:o.referralDirectory.toLowerCase(),AURI_INTERNAL_LENS:o.auriInternalLens.toLowerCase()},tokens:{AURORA:"0x8bec47865ade3b172a928df8f990bc7f2a3b9f79".toLowerCase(),PLY:"0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f".toLowerCase(),stNEAR:"0x07f9f7f963c5cd2bbffd30ccfb964be114332e30".toLowerCase(),USDC:"0xb12bfca5a55806aaf64e99521918a4bf0fc40802".toLowerCase(),WNEAR:"0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d".toLowerCase(),TRI:"0xFa94348467f64D5A457F75F8bc40495D33c65aBB".toLowerCase(),META:"0xc21ff01229e982d7c8b8691163b0a3cb8f357453".toLowerCase(),PULP:o.PULP.toLowerCase(),PLYWNEAR:o.ply_wnear_lp.toLowerCase(),USN:"0x5183e1b1091804bc2602586919e6880ac1cf2896".toLowerCase()}},E=new Set([].concat(L.auTokens.map((function(e){return e.underlying})),[L.tokens.AURORA,L.tokens.TRI,L.tokens.META,L.tokens.stNEAR])),R=new t(1),C=["0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f","0x04Ac48711BCdc45b4d223fb021E09DA73c71095e","0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d","0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30","0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79","0xFa94348467f64D5A457F75F8bc40495D33c65aBB"],P=[0],T=r.BigNumber.from(2).pow(256).sub(1),S=Object.fromEntries(Object.entries({"0xb12bfca5a55806aaf64e99521918a4bf0fc40802":"36375","0x4988a896b1227218e4a686fde5eabdcabd91571f":"14550","0xf4eb217ba2454613b15dbdea6e5f22276410e89e":"3638","0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE":"14550","0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d":"3638"}).map((function(e){var t=e[1];return[e[0].toLowerCase(),t]}))),B={},_=Object.fromEntries([[L.tokens.USN.toLowerCase(),"1"]]),N={"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee":18,"0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f":18,"0x3195949f267702723bc614cae037cdc8d1e94786":8,"0xfa94348467f64d5a457f75f8bc40495d33c65abb":18,"0x07f9f7f963c5cd2bbffd30ccfb964be114332e30":24,"0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d":24,"0x6ea6c03061bddce23d4ec60b6e6e880c33d24dca":8,"0xca9511b610ba5fc7e311fdef9ce16050ee4449e9":8,"0x8bec47865ade3b172a928df8f990bc7f2a3b9f79":18,"0xcfb6b0498cb7555e7e21502e0f449bf28760adbb":8,"0x4f0d864b1abf4b701799a0b30b57a22dfeb5917b":8,"0xad5a2437ff55ed7a8cad3b797b3ec7c5a19b1c54":8,"0x4988a896b1227218e4a686fde5eabdcabd91571f":6,"0xb12bfca5a55806aaf64e99521918a4bf0fc40802":6,"0xe3520349f477a5f6eb06107066048508498a291b":18,"0x8888682e24dd4df7b7ff2b91fccb575737e433bf":8,"0xae4fac24dcdae0132c6d04f564dcf059616e9423":8,"0xce4166363e3a584dac84a47bcd3414b43efcdd1c":8,"0xf4eb217ba2454613b15dbdea6e5f22276410e89e":8,"0xc21ff01229e982d7c8b8691163b0a3cb8f357453":24,"0x04ac48711bcdc45b4d223fb021e09da73c71095e":18,"0x044b6b0cd3bb13d2b9057781df4459c66781dce7":18,"0x5183e1b1091804bc2602586919e6880ac1cf2896":18};function D(e,t,r,n,o,a,i){try{var u=e[a](i),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,o)}function O(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){D(a,n,o,i,u,"next",e)}function u(e){D(a,n,o,i,u,"throw",e)}i(void 0)}))}}function U(){return(U=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function I(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function M(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return F(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?F(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var W,j=function(e){this._networkConnection=e},Y=function(e){function t(t){if(!(t.signer instanceof k.Signer))throw Error("Signer is not provided when constructing BlockchainEntityReadWrite");return e.call(this,t)||this}return I(t,e),t}(j),q=function(){function e(){}var t=e.prototype;return t.read=function(e){return new j(e)},t.readWrite=function(e){return new Y(e)},e}(),H=function(e){function t(t){var r;return(r=e.call(this,t)||this).comptroller=r.getContract(L.misc.COMPTROLLER,d.abi),r.auriFairLaunch=r.getContract(L.misc.AURIFAIRLAUNCH,c.abi),r.auriLens=r.getContract(L.misc.AURILENS,p.abi),r.ply=r.getContract(L.tokens.PLY,w.abi),r.pulp=r.getContract(L.tokens.PULP,b.abi),r.auriInternalLens=r.getContract(L.misc.AURI_INTERNAL_LENS,m.abi),r}return I(t,e),t.prototype.getContract=function(e,t){return new r.Contract(e,t,this._networkConnection.provider)},t}(j),G=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),a=new A(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var u=g(i,r);if(u){if(u===p)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=c(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,a),o}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var p={};function f(){}function l(){}function d(){}var h={};u(h,o,(function(){return this}));var w=Object.getPrototypeOf,m=w&&w(w(L([])));m&&m!==t&&r.call(m,o)&&(h=m);var v=d.prototype=f.prototype=Object.create(h);function y(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var n;this._invoke=function(o,a){function i(){return new t((function(n,i){!function n(o,a,i,u){var s=c(e[o],e,a);if("throw"!==s.type){var p=s.arg,f=p.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,i,u)}),(function(e){n("throw",e,i,u)})):t.resolve(f).then((function(e){p.value=e,i(p)}),(function(e){return n("throw",e,i,u)}))}u(s.arg)}(o,a,n,i)}))}return n=n?n.then(i,i):i()}}function g(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,g(e,t),"throw"===t.method))return p;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,p;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function L(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:E}}function E(){return{value:void 0,done:!0}}return l.prototype=d,u(v,"constructor",d),u(d,"constructor",l),l.displayName=u(d,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===l||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,u(e,i,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},y(b.prototype),u(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new b(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},y(v),u(v,i,"Generator"),u(v,o,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=L,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,p):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:L(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(W={exports:{}}),W.exports),K=Object.fromEntries(L.auTokens.map((function(e){return[e.address.toLowerCase(),e.name]})));function V(e,t,r){return z.apply(this,arguments)}function z(){return(z=O(G.mark((function e(t,r,n){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n&&(n={}),n=U({},n,{module:t,action:r}),e.next=4,x.get("https://api.aurorascan.dev/api?"+new URLSearchParams(n),{headers:{"Content-Type":"application/json"}});case 4:return e.abrupt("return",e.sent.data.result);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Q(e,t){if(void 0===t&&(t=""),!e)throw t="Assertion failed"+(t?": "+t:""),new Error(t)}function Z(e){return JSON.stringify(e,null," ")}function J(e){return r.BigNumber.from(10).pow(e).toString()}var $=function(e,t){return e.toLowerCase()==t.toLowerCase()},X=function(){return Math.trunc(Date.now()/1e3)};function ee(e){try{return r.utils.getAddress(e)}catch(t){throw new Error("Invalid address: "+e)}}function te(e){var t=e.toLowerCase();return Q(null!=N[t],"Decimal not found for "+e),N[t]}function re(e){var t=e.toLowerCase();return Q(null!=K[t],"Symbol not found for "+e),K[t]}function ne(e,r,n){return e.isZero()?new t(0):r.lte(0)?e:e.multipliedBy(n).dividedBy(r)}function oe(e,t){return ae.apply(this,arguments)}function ae(){return(ae=O(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getBlock(r);case 2:return e.abrupt("return",e.sent.timestamp);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ie(e,t){return ue.apply(this,arguments)}function ue(){return(ue=O(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,V("block","getblocknobytime",{timestamp:r,closest:"before"});case 2:if(e.t0=parseInt(e.sent),e.t0){e.next=8;break}return e.next=7,t.getBlockNumber();case 7:e.t0=e.sent;case 8:return e.abrupt("return",e.t0);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function se(e){}var ce=function(e,t){this.address=e.toLowerCase(),this.decimals=t},pe=new ce(L.tokens.PLY,te(L.tokens.PLY)),fe=new ce(L.tokens.PLYWNEAR,te(L.tokens.PLYWNEAR)),le=function(){function e(e,r,n){void 0===n&&(n=!0),this.rawAmnt=n?r:new t(r).times(J(e.decimals)).toFixed(0),this.token=e}var r=e.prototype;return r.formattedAmount=function(){return new t(this.rawAmnt).div(J(this.token.decimals)).toString()},r.rawAmount=function(){return this.rawAmnt},e.fromAddressAndAmount=function(t,r,n){return void 0===n&&(n=!0),new e(new ce(t,te(t)),r,n)},e}(),de=new ce("0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",6),he=new ce("0x8729438eb15e2c8b576fcc6aecda6a148776c0f5",18),we=new ce("0xE530dC2095Ef5653205CF5ea79F8979a7028065c",18),me=new le(de,"123.456",!1),ve=new le(de,"0"),ye=new le(de,"456.123",!1),be=new le(de,"1000.123",!1),ge={market:"0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f",depositBalance:ye,borrowBalance:ve,isCollateral:!0,maxWithdrawableAmount:me,collateralRatio:.5,underlyingPrice:"1"};function ke(e){return xe.apply(this,arguments)}function xe(){return(xe=O(G.mark((function e(r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,x.get("https://api.coingecko.com/api/v3/simple/price?ids="+r+"&vs_currencies=usd").then((function(e){return e.data}));case 2:return e.abrupt("return",new t(e.sent[r].usd));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ae(e){return Le.apply(this,arguments)}function Le(){return(Le=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t.toLowerCase(),e.next=e.t0===L.tokens.AURORA?3:e.t0===L.tokens.TRI?4:e.t0===L.tokens.META?5:6;break;case 3:return e.abrupt("return",ke("aurora-near"));case 4:return e.abrupt("return",ke("trisolaris"));case 5:return e.abrupt("return",ke("meta-pool"));case 6:throw Error("Unknown token "+t+" in fetchPriceFromCoingecko");case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ee(e,t){return Re.apply(this,arguments)}function Re(){return(Re=O(G.mark((function e(t,n){var o,a,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=new r.Contract(t,v.abi,n),(a=[]).push(o.token0()),a.push(o.token1()),a.push(o.getReserves()),a.push(o.totalSupply()),e.next=8,Promise.all(a);case 8:return e.abrupt("return",{token0:(i=e.sent)[0],token1:i[1],reserve0:i[2].reserve0,reserve1:i[2].reserve1,totalSupply:i[3]});case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ce(e,t){return Pe.apply(this,arguments)}function Pe(){return(Pe=O(G.mark((function e(r,n){var o,a,i,u;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=function(){return(u=O(G.mark((function e(r){var i,u,s;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r.reserve.isZero()){e.next=2;break}return e.abrupt("return",new t(0));case 2:return e.next=4,Ie(r.address,n);case 4:return i=e.sent,u=te(r.address),s=i.multipliedBy(r.reserve.toString()).multipliedBy(2),e.abrupt("return",s.multipliedBy(J(a)).dividedBy(new t(o.totalSupply.toString())).dividedBy(J(u)));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)},i=function(e){return u.apply(this,arguments)},e.next=4,Ee(r,n);case 4:return o=e.sent,a=te(r),e.prev=6,e.next=9,i({address:o.token0,reserve:o.reserve0});case 9:return e.abrupt("return",e.sent);case 12:return e.prev=12,e.t0=e.catch(6),e.prev=15,e.next=18,i({address:o.token1,reserve:o.reserve1});case 18:return e.abrupt("return",e.sent);case 21:throw e.prev=21,e.t1=e.catch(15),Error("Unable to fetch price for both tokens of LP "+r);case 25:case"end":return e.stop()}}),e,null,[[6,12],[15,21]])})))).apply(this,arguments)}function Te(e,r){return new t(e.toString()).div(J(36-r))}function Se(e,t,r){return Be.apply(this,arguments)}function Be(){return(Be=O(G.mark((function e(t,n,o){var a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=new r.Contract(L.misc.oracle,f.abi,o),e.next=3,a.getUnderlyingPrice(t);case 3:return e.abrupt("return",Te(e.sent,n));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _e(e){return Ne.apply(this,arguments)}function Ne(){return(Ne=O(G.mark((function e(t){var n,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new r.Contract(L.misc.AURILENS,p.abi,t),o=L.auTokens.map((function(e){return e.address})),a=L.auTokens.map((function(e){return te(e.underlying)})),e.next=5,n.auTokenUnderlyingPriceAll(o);case 5:return e.abrupt("return",e.sent.map((function(e,t){return{auToken:e.auToken,underlyingPrice:Te(e.underlyingPrice,a[t])}})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function De(){return Oe.apply(this,arguments)}function Oe(){return(Oe=O(G.mark((function e(){var r,n,o,a,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=x.get("https://validators.narwallets.com/metrics_json").then((function(e){return e.data})),n=ke("near"),e.next=4,Promise.all([r,n]);case 4:return a=(o=e.sent)[1],i=new t(o[0].st_near_price),e.abrupt("return",i.multipliedBy(a));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ue(e){return(e=e.toLowerCase())==L.tokens.AURORA||e==L.tokens.TRI||e==L.tokens.META}function Ie(e,t){return Fe.apply(this,arguments)}function Fe(){return(Fe=O(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Q(E.has(t.toLocaleLowerCase()),"Address "+t+" is not whitelisted for price fetching"),!$(t,L.tokens.stNEAR)){e.next=3;break}return e.abrupt("return",De());case 3:if(!Ue(t)){e.next=5;break}return e.abrupt("return",Ae(t));case 5:if(void 0===(n=L.auTokens.find((function(e){return $(e.underlying,t)})))){e.next=10;break}return e.abrupt("return",Se(n.address,te(t),r));case 10:throw Error("Unable to fetch price for "+t);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Me(e,t){return We.apply(this,arguments)}function We(){return(We=O(G.mark((function e(r,n){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.toLowerCase()in _)){e.next=4;break}return e.abrupt("return",new t(_[r.toLowerCase()]));case 4:if(!$(r,L.tokens.PLYWNEAR)){e.next=8;break}return e.abrupt("return",Ce(r,n));case 8:if(!$(r,L.tokens.PLY)){e.next=12;break}return e.abrupt("return",je(n));case 12:if(!$(r,L.tokens.PULP)){e.next=14;break}return e.abrupt("return",qe(n));case 14:return e.abrupt("return",Ie(r,n));case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function je(e){return Ye.apply(this,arguments)}function Ye(){return(Ye=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Ge(L.tokens.PLYWNEAR,t));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qe(e){return He.apply(this,arguments)}function He(){return(He=O(G.mark((function e(r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new t(0));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ge(e,t){return Ke.apply(this,arguments)}function Ke(){return(Ke=O(G.mark((function e(r,n){var o,a,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ee(r,n);case 2:if(!(o=e.sent).reserve1.isZero()){e.next=5;break}return e.abrupt("return",new t(0));case 5:return a=te(o.token0),i=te(o.token1),e.next=9,Me(o.token1,n);case 9:return e.abrupt("return",e.sent.multipliedBy(o.reserve1.toString()).multipliedBy(J(a)).dividedBy(J(i)).dividedBy(o.reserve0.toString()));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ve(e,t){return ze.apply(this,arguments)}function ze(){return(ze=O(G.mark((function e(r,n){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("0"!=r.rawAmount()){e.next=2;break}return e.abrupt("return",new t(0));case 2:return e.next=4,Me(r.token.address,n);case 4:return e.abrupt("return",Qe(r,e.sent));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Qe(e,r){return new t(e.formattedAmount()).multipliedBy(r)}function Ze(e,t){return Je.apply(this,arguments)}function Je(){return(Je=O(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ve(t,r);case 2:return e.abrupt("return",{tokenAmount:t,currencyAmount:{currency:"USD",amount:e.sent.toFixed(10)}});case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var $e,Xe,et=function(e){function t(t,n){var o;return(o=e.call(this,n)||this).auToken=new r.Contract(t,l.abi,o._networkConnection.provider),o}I(t,e);var n=t.prototype;return n.queryERC20TransfersOf=function(){var e=O(G.mark((function e(t,r,n){var o,a,i,u=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=[this.auToken.filters.Transfer(t,null),this.auToken.filters.Transfer(null,t)],e.next=3,Promise.all(o.map((function(e){return u.auToken.queryFilter(e,r,n)})));case 3:return a=e.sent.flat(),(i=a.map((function(e){return{from:e.args[0],to:e.args[1],amount:e.args[2],blockNumber:e.blockNumber}}))).sort((function(e,t){return e.blockNumber-t.blockNumber})),e.abrupt("return",i);case 7:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),n.queryERC20BalanceAt=function(){var e=O(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.auToken.balanceOf(t,{blockTag:r+1}));case 1:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t}(j),tt={__proto__:null,getQuery:V,assert:Q,formatObject:Z,decimalFactor:J,isSameAddress:$,getCurrentTimestamp:X,validateAndParseAddress:ee,getDecimal:te,getSymbol:re,calcLMRewardApr:ne,getBlockTimestamp:oe,getBlockBeforeTimestamp:ie,devLog:se,fetchPriceFromCoingeckoAPI:ke,fetchPriceFromCoingecko:Ae,fetchLPPositions:Ee,fetchLPPrice:Ce,fetchPriceFromOracle:Se,fetchUnderlyingTokensPrices:_e,fetchStNEARPrice:De,fetchPrice:Me,fetchPLYPrice:je,fetchPULPPrice:qe,fetchToken0PriceByLP:Ge,fetchValuation:Ve,calcValuation:Qe,valuateToken:Ze,TransferEventQuery:et},rt=function(e){function t(t){var n;return(n=e.call(this,t)||this).airDrop=new r.Contract(L.misc.AURI_AIRDROP,s.abi,t.provider),n}return I(t,e),t.prototype.getRedeemableReward=function(){var e=O(G.mark((function e(t,n,o){var a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=new ce(n,te(n)),e.next=3,this.airDrop.getRedeemableReward(r.utils.formatBytes32String(t),n,o);case 3:return e.abrupt("return",new le(a,e.sent.toString()));case 5:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),t}(j),nt=function(e){function t(){return e.apply(this,arguments)||this}I(t,e);var n=t.prototype;return n.redeemMultiple=function(){var e=O(G.mark((function e(t,n){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Q(t.length==n.length,"campaigns and tokens must have the same length"),e.t0=this.airDrop.connect(this._networkConnection.signer),e.t1=t.map((function(e){return r.utils.formatBytes32String(e)})),e.t2=n,e.next=6,this._networkConnection.signer.getAddress();case 6:return e.t3=e.sent,e.abrupt("return",e.t0.redeem.call(e.t0,e.t1,e.t2,e.t3));case 8:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),n.redeemSingle=function(){var e=O(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.redeemMultiple([t],[r]));case 1:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t}(rt),ot=function(e){function t(){return e.call(this)||this}I(t,e);var r=t.prototype;return r.read=function(e){return new rt(e)},r.readWrite=function(e){return new nt(e)},t}(q);($e=exports.ComptrollerRewardType||(exports.ComptrollerRewardType={}))[$e.PLY=0]="PLY",$e[$e.AURORA=1]="AURORA",(Xe=exports.MarketAction||(exports.MarketAction={}))[Xe.Deposit=0]="Deposit",Xe[Xe.Borrow=1]="Borrow",Xe[Xe.Withdraw=2]="Withdraw",Xe[Xe.Repay=3]="Repay",Xe[Xe.EnableCollateral=4]="EnableCollateral",Xe[Xe.DisableCollateral=5]="DisableCollateral";var at=function(e){function n(t,n,o){var a;return(a=e.call(this,t)||this).env=new H(t),a.auToken=$(o,A)?new r.Contract(n,u.abi,t.provider):new r.Contract(n,i.abi,t.provider),a.underlying=new ce(o,te(o)),a}I(n,e);var o=n.prototype;return o.getRewardSpeeds=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriLens.getRewardSpeeds(this.env.comptroller.address,this.auToken.address);case 2:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getTotalTokenBorrowed=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=le,e.t1=this.underlying,e.next=4,this.auToken.totalBorrows();case 4:return e.t2=e.sent.toString(),e.abrupt("return",new e.t0(e.t1,e.t2));case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getTotalTokenDeposited=function(){var e=O(G.mark((function e(){var t,n,o,a=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(t=[]).push(this.getTotalTokenBorrowed().then((function(e){n=e}))),t.push(this.auToken.getCash().then((function(e){o=new le(a.underlying,e.toString())}))),e.next=5,Promise.all(t);case 5:return e.abrupt("return",new le(this.underlying,r.BigNumber.from(o.rawAmount()).add(n.rawAmount()).toString()));case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getDepositAPY=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.auToken.supplyRatePerTimestamp();case 2:return e.abrupt("return",new t(e.sent.toString()).multipliedBy(31536e3).div(J(18)));case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getBorrowAPY=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.auToken.borrowRatePerTimestamp();case 2:return e.abrupt("return",new t(e.sent.toString()).multipliedBy(31536e3).div(J(18)));case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getCollateralRatio=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.comptroller.markets(this.auToken.address).then((function(e){return new t(e.collateralFactorMantissa.toString()).div(J(18))})));case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getBorrowPlyAPY=function(){var e=O(G.mark((function e(){var t,r,n,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(t=[]).push(this.getTotalTokenBorrowed().then((function(e){r=e}))),t.push(this.env.comptroller.rewardSpeeds(exports.ComptrollerRewardType.PLY,this.auToken.address,!1).then((function(e){n=new le(pe,e.toString())}))),t.push(Me(L.tokens.PLY,this._networkConnection.provider).then((function(e){o=e}))),t.push(Me(this.underlying.address,this._networkConnection.provider).then((function(e){a=e}))),e.next=7,Promise.all(t);case 7:return e.abrupt("return",ne(o.multipliedBy(n.formattedAmount()),a.multipliedBy(r.formattedAmount()),31536e3));case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getDepositPlyAPY=function(){var e=O(G.mark((function e(){var t,r,n,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(t=[]).push(this.getTotalTokenDeposited().then((function(e){r=e}))),t.push(this.env.comptroller.rewardSpeeds(exports.ComptrollerRewardType.PLY,this.auToken.address,!0).then((function(e){n=new le(pe,e.toString())}))),t.push(Me(L.tokens.PLY,this._networkConnection.provider).then((function(e){o=e}))),t.push(Me(this.underlying.address,this._networkConnection.provider).then((function(e){a=e}))),e.next=7,Promise.all(t);case 7:return e.abrupt("return",ne(o.multipliedBy(n.formattedAmount()),a.multipliedBy(r.formattedAmount()),31536e3));case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getDetails=function(){var e=O(G.mark((function e(){var r,n,o,a,i,u,s,c,p,f,l,d,h,w;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=[]).push(this.getTotalTokenDeposited().then((function(e){n=e}))),r.push(this.getTotalTokenBorrowed().then((function(e){o=e}))),r.push(this.getDepositAPY().then((function(e){a=e.toNumber()}))),r.push(this.getBorrowAPY().then((function(e){i=e.toNumber()}))),r.push(this.getCollateralRatio().then((function(e){u=e.toNumber()}))),r.push(this.getRewardSpeeds().then((function(e){p=e}))),r.push(Me(L.tokens.PLY,this._networkConnection.provider).then((function(e){s=e}))),r.push(Me(this.underlying.address,this._networkConnection.provider).then((function(e){c=e}))),e.next=11,Promise.all(r);case 11:return f=ne(Qe(new le(pe,p.plyRewardBorrowSpeed.toString()),s),c.multipliedBy(o.formattedAmount()),31536e3),l=ne(Qe(new le(pe,p.plyRewardSupplySpeed.toString()),s),c.multipliedBy(n.formattedAmount()),31536e3),e.t0=tt,e.next=16,Ve(this.getDepositNEARRewardPerWeek(),this._networkConnection.provider);case 16:return e.t1=e.sent,e.t2=c.multipliedBy(n.formattedAmount()),d=e.t0.calcLMRewardApr.call(e.t0,e.t1,e.t2,52),e.t3=tt,e.next=22,Ve(this.getBorrowNEARRewardPerWeek(),this._networkConnection.provider);case 22:return e.t4=e.sent,e.t5=c.multipliedBy(o.formattedAmount()),h=e.t3.calcLMRewardApr.call(e.t3,e.t4,e.t5,52),w=$(this.underlying.address,L.tokens.stNEAR)?ne(new t(5e4),c.multipliedBy(n.formattedAmount()),12):new t(0),e.abrupt("return",{auTokenAddress:this.auToken.address,totalTokenDeposited:n,totalTokenBorrowed:o,depositApy:a,depositPlyApy:l.toNumber(),borrowApy:i,borrowPlyApy:-1*f.toNumber(),collateralRatio:u,depositPlyPerWeek:new le(pe,p.plyRewardSupplySpeed.mul(86400).mul(7).toString()),borrowPlyPerWeek:new le(pe,p.plyRewardBorrowSpeed.mul(86400).mul(7).toString()),depositNEARApy:d.toNumber(),borrowNEARApy:-1*h.toNumber(),depositMETAApy:w.toNumber()});case 27:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getUserBorrowBalance=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.auToken.callStatic.borrowBalanceCurrent(t);case 2:return e.abrupt("return",new le(this.underlying,e.sent.toString()));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.getUserDepositBalance=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.auToken.callStatic.balanceOfUnderlying(t);case 2:return e.abrupt("return",new le(this.underlying,e.sent.toString()));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.getDepositNEARRewardPerWeek=function(){var e=new ce(L.tokens.WNEAR,te(L.tokens.WNEAR)),t=X();if(t<=1651845600&&t>1650636e3){var r,n=null!=(r=S[this.underlying.address.toLocaleLowerCase()])?r:"0";return new le(e,n,!1)}return new le(e,"0")},o.getBorrowNEARRewardPerWeek=function(){var e=new ce(L.tokens.WNEAR,te(L.tokens.WNEAR)),t=X();if(t<=1651845600&&t>1650636e3){var r,n=null!=(r=B[this.underlying.address.toLocaleLowerCase()])?r:"0";return new le(e,n,!1)}return new le(e,"0")},n}(j),it=function(e){function n(t,n,o){var a;return(a=e.call(this,t,n,o)||this)._EthRepayHelper=new r.Contract(L.misc.ETHREPAYHELPER,h.abi,t.provider),a}I(n,e);var o=n.prototype;return o.deposit=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!$(t.token.address,A)){e.next=4;break}return e.abrupt("return",this.auToken.connect(this._networkConnection.signer).mint({value:t.rawAmount()}));case 4:return e.abrupt("return",this.auToken.connect(this._networkConnection.signer).mint(t.rawAmount()));case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.borrow=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.auToken.connect(this._networkConnection.signer).borrow(t.rawAmount()));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.withdraw=function(){var e=O(G.mark((function e(r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!new t(r.rawAmount()).lt(0)){e.next=2;break}return e.abrupt("return",this.auToken.connect(this._networkConnection.signer).redeemUnderlying(T));case 2:return e.abrupt("return",this.auToken.connect(this._networkConnection.signer).redeemUnderlying(r.rawAmount()));case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.repay=function(){var e=O(G.mark((function e(r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!$(r.token.address,A)){e.next=4;break}return e.abrupt("return",this._EthRepayHelper.connect(this._networkConnection.signer).repayBorrow({value:r.rawAmount()}));case 4:if(!new t(r.rawAmount()).lt(0)){e.next=8;break}return e.abrupt("return",this.auToken.connect(this._networkConnection.signer).repayBorrow(T));case 8:return e.abrupt("return",this.auToken.connect(this._networkConnection.signer).repayBorrow(r.rawAmount()));case 9:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.enableCollateral=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.disableCollateral=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),n}(at),ut=function(e){function t(t,r){var n;return(n=e.call(this)||this).address=ee(t),n.underlying=ee(r),n}I(t,e);var r=t.prototype;return r.read=function(e){return new at(e,this.address,this.underlying)},r.readWrite=function(e){return new it(e,this.address,this.underlying)},t}(q),st=function(e){function t(t){var n;return(n=e.call(this,t)||this).multicall=new r.Contract(L.misc.MULTICALL,y.abi,t.provider),n}return I(t,e),t.prototype.aggregate=function(){var e=O(G.mark((function e(t){var n,o,a,i,u,s,c,p;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=[],o=0;case 2:if(!(o<t.length)){e.next=11;break}return i=t[o],e.next=6,(a=i.contract.populateTransaction)[i.method].apply(a,i.args);case 6:n.push({target:(u=e.sent).to,callData:u.data});case 8:o++,e.next=2;break;case 11:return e.next=13,this.multicall.callStatic.aggregate(n);case 13:for(s=e.sent,c=[],p=0;p<t.length;p++)c.push(r.ethers.utils.defaultAbiCoder.decode(t[p].returnTypes,s.returnData[p]));return e.abrupt("return",c);case 17:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(j),ct=r.BigNumber.from(1e4),pt=function(e){function n(t){var r;(r=e.call(this,t)||this).env=new H(t);var n=L.tokens.PLY,o=L.tokens.PULP;return r.plyToken=new ce(n,te(n)),r.pulpToken=new ce(o,te(o)),r}I(n,e);var o=n.prototype;return o.getPlyBalance=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.ply.balanceOf(t);case 2:return e.abrupt("return",new le(this.plyToken,e.sent.toString()));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.getPulpBalance=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.pulp.balanceOf(t);case 2:return e.abrupt("return",new le(this.pulpToken,e.sent.toString()));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.getUnclaimedPlyReward=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriLens.callStatic.claimRewards(this.env.comptroller.address,this.env.auriFairLaunch.address,P,{from:t});case 2:return e.abrupt("return",new le(this.plyToken,e.sent.plyAccrured.toString()));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.getWeek=function(e){return r.BigNumber.from(e-1651759200).div(604800).toNumber()},o.getLockingDetails=function(){var e=O(G.mark((function e(n){var o,a,i,u,s,c,p,f,l,d,h,w,m;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=this.getWeek(X()),(a=[]).push(this.env.auriLens.getPercentLock(this.env.pulp.address,n,o)),a.push(this.env.auriLens.getPercentLock(this.env.pulp.address,n,o+1)),a.push(this.getUnclaimedPlyReward(n)),e.next=7,Promise.all(a);case 7:return u=r.BigNumber.from((i=e.sent)[0]),s=r.BigNumber.from(i[1]),c=i[2],e.next=13,this.env.pulp.calcLockAmount(n,c.rawAmount());case 13:return f=(p=e.sent)[0],l=p[1],d=s.mul(c.rawAmount()).div(ct),h=r.BigNumber.from(c.rawAmount()).sub(d),w=ct.sub(u).toString(),m=ct.sub(s).toString(),e.abrupt("return",{vestingStart:1651759200,currentUnlockPortion:new t(w).dividedBy(100).toNumber(),accruedPly:c,currentPly:new le(this.plyToken,l.toString()),currentPulp:new le(this.pulpToken,f.toString()),nextUnlockPortion:new t(m).dividedBy(100).toNumber(),nextPly:new le(this.plyToken,d.toString()),nextPulp:new le(this.pulpToken,h.toString())});case 21:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.getTimestampToUnlock=function(){var e=O(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriLens.getWeekToUnlock(this.env.pulp.address,t,100*r);case 2:return e.abrupt("return",1651759200+604800*e.sent.toNumber());case 4:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),o.getNextWeekTimestamp=function(){return 1651759200+604800*(this.getWeek(X())+1)},o.getUnlockPortionAt=function(){var e=O(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriLens.getPercentLock(this.env.pulp.address,t,this.getWeek(r));case 2:return n=ct.sub(e.sent),e.abrupt("return",n.toNumber()/100);case 5:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),n}(j),ft=function(e){function t(t){return e.call(this,t)||this}I(t,e);var r=t.prototype;return r.redeem=function(){var e=O(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.pulp.connect(this._networkConnection.signer).redeem(t,r.rawAmount()));case 1:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.selfRedeem=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._networkConnection.signer.getAddress();case 2:return e.abrupt("return",this.redeem(e.sent,t));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(pt),lt=function(e){function t(){return e.call(this)||this}I(t,e);var r=t.prototype;return r.read=function(e){return new pt(e)},r.readWrite=function(e){return new ft(e)},t}(q),dt=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new H(t),r}I(t,e);var n=t.prototype;return n.getPLYWNEARPoolDetails=function(){var e=O(G.mark((function e(){var t,r,n,o,a,i,u,s,c;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriFairLaunch.getPoolInfo(0).then((function(e){t=e.totalStake,r=e.rewardPerSeconds}));case 2:return n=new le(fe,t.toString()),e.next=5,Ve(n,this._networkConnection.provider);case 5:for(o=e.sent,a=[],i=0;i<r.length;i++)s=new ce(u=C[i],te(u)),a.push(Ve(new le(s,r[i].toString()),this._networkConnection.provider));return c=[],e.next=11,Promise.all(a);case 11:return e.sent.forEach((function(e,t){var r=C[t],n=ne(e,o,31536e3).toFixed(10);c.push({address:r,apy:n})})),e.abrupt("return",{totalStakedLiquidity:n,APYs:c});case 13:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),n.stakeBalanceOf=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriFairLaunch.getUserInfo(0,t);case 2:return e.abrupt("return",new le(fe,e.sent.amount.toString()));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.LpBalanceOf=function(){var e=O(G.mark((function e(t){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new r.Contract(L.tokens.PLYWNEAR,w.abi,this._networkConnection.provider),e.next=3,n.balanceOf(t);case 3:return e.abrupt("return",new le(fe,e.sent.toString()));case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.unclaimedRewardsOf=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriFairLaunch.callStatic.updateAndGetUserInfo(0,t,{from:t});case 2:return e.abrupt("return",e.sent.unclaimedRewards.map((function(e,t){return le.fromAddressAndAmount(C[t],e.toString())})));case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(j),ht=function(e){function t(){return e.apply(this,arguments)||this}I(t,e);var n=t.prototype;return n.stake=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.auriFairLaunch.connect(this._networkConnection.signer).deposit(0,t.rawAmount()));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.unstake=function(){var e=O(G.mark((function e(t){var n,o,a,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._networkConnection.signer.getAddress();case 2:return n=e.sent,o=r.BigNumber.from(t.rawAmount()),e.t0=r.BigNumber,e.next=7,this.stakeBalanceOf(n);case 7:return e.t1=e.sent.rawAmount(),a=e.t0.from.call(e.t0,e.t1),i=o.lt(a)?o:a.sub(1),e.abrupt("return",this.env.auriFairLaunch.connect(this._networkConnection.signer).withdraw(0,i));case 11:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(dt),wt=function(e){function t(){return e.call(this)||this}I(t,e);var r=t.prototype;return r.read=function(e){return new dt(e)},r.readWrite=function(e){return new ht(e)},t}(q),mt=function(e){function n(t){var r;return(r=e.call(this,t)||this).stakingRead=new dt(t),r.env=new H(t),r}I(n,e);var o=n.prototype;return o.getUserDetails=function(){var e=O(G.mark((function e(r){var n,o,a,i,u,s,c,p,f,l,d,h,w,m,v,y,b,g,k,x,A,E=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(n=L.auTokens.length,o=[],i=[],u=new t(0),s=[],c=function(){var e=f.value,t={};o.push(t),t.market=e.underlying;var n=new at(E._networkConnection,e.address,e.underlying);i.push(n.getUserDepositBalance(r).then((function(e){t.depositBalance=e}))),i.push(n.getUserBorrowBalance(r).then((function(e){t.borrowBalance=e}))),i.push(n.getCollateralRatio().then((function(e){t.collateralRatio=e.toNumber()}))),s.push(Me(n.underlying.address,E._networkConnection.provider).then((function(e){return t.underlyingPrice=e.toString(),e})))},p=M(L.auTokens);!(f=p()).done;)c();return i.push(this.env.comptroller.getAssetsIn(r).then((function(e){a=e}))),e.next=10,Promise.all(i);case 10:return e.next=12,Promise.all(s);case 12:for(l=e.sent,d=[],h=function(){var e=L.auTokens[w];o[w].isCollateral=void 0!==a.find((function(t){return $(e.address,t)})),d.push(Qe(o[w].depositBalance,l[w]))},w=0;w<n;w++)h();return u=d.reduce((function(e,t,r){return o[r].isCollateral?e.plus(t.multipliedBy(o[r].collateralRatio)):e}),new t(0)),e.next=19,this.env.comptroller.getAccountLiquidity(r);case 19:for((m=u.minus(new t(e.sent[0].toString()).div(J(18)))).lt("0.00001")&&(m=new t(0)),v=u.multipliedBy(R),y=m.div(R),b=v.lte(m)?new t(0):v.minus(m),w=0;w<n;w++)k=new at(this._networkConnection,(g=L.auTokens[w]).address,g.underlying),x=u.minus(y).gt(0)?u.minus(y):new t(0),A=x.div(o[w].collateralRatio).div(l[w]),o[w].maxWithdrawableAmount=o[w].isCollateral&&A.lt(o[w].depositBalance.formattedAmount())?new le(k.underlying,A.toFixed(24),!1):new le(k.underlying,o[w].depositBalance.rawAmount());return e.t0=o,e.t1={currency:"USD",amount:v.toFixed(10)},e.next=30,new pt(this._networkConnection).getLockingDetails(r);case 30:return e.t2=e.sent,e.t3={currency:"USD",amount:b.toFixed(10)},e.abrupt("return",{markets:e.t0,borrowLimit:e.t1,userLockingDetails:e.t2,borrowableAmount:e.t3});case 33:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.getTokenPrice=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Me(t.address,this._networkConnection.provider);case 2:return e.abrupt("return",{currency:"USD",amount:e.sent.toFixed(10)});case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.calcHypotheticalStats=function(e){var r=e.userMarketDetail,n=e.currentBorrowValuation,o=e.action,a=e.tokenAmount,i=new t(e.currentBorrowLimit.amount),u=new t(n.amount);switch(o){case exports.MarketAction.EnableCollateral:case exports.MarketAction.DisableCollateral:var s=Qe(r.depositBalance,new t(r.underlyingPrice)).multipliedBy(r.collateralRatio).multipliedBy(R);i=o==exports.MarketAction.EnableCollateral?i.plus(s):i.minus(s);break;case exports.MarketAction.Deposit:case exports.MarketAction.Withdraw:s=Qe(a,new t(r.underlyingPrice)).multipliedBy(r.collateralRatio).multipliedBy(R),i=o==exports.MarketAction.Deposit?i.plus(s):i.minus(s);break;case exports.MarketAction.Borrow:case exports.MarketAction.Repay:var c=Qe(a,new t(r.underlyingPrice));u=o==exports.MarketAction.Borrow?u.plus(c):u.minus(c)}return{newBorrowLimit:{amount:i.toFixed(10),currency:"USD"},newBorrowUtilization:i.eq(0)?u.eq(0)?0:9999.99:u.div(i).toNumber()}},o.getPlyCirculatingSupply=function(){var e=O(G.mark((function e(){var t,n,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new st(this._networkConnection),n={contract:this.env.ply,method:"balanceOf",returnTypes:["uint256"]},e.next=4,t.aggregate([U({},n,{method:"totalSupply",args:[]}),U({},n,{args:[L.misc.TEAM_MULTISIG]}),U({},n,{args:[L.misc.COMPTROLLER]}),U({},n,{args:[L.misc.AURIFAIRLAUNCH]}),U({},n,{args:[L.misc.PLY_TOKEN_LOCK]})]);case 4:return o=e.sent,a=r.BigNumber.from(0),o.forEach((function(e,t){a=0===t?e[0]:a.sub(e[0])})),e.abrupt("return",new le(pe,a.toString()));case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),o.getUltilizations=function(){var e=O(G.mark((function e(r){var n,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriInternalLens.getAccountLiquidity(r);case 2:return o=new t((n=e.sent).sumBorrowPlusEffects.toString()),a=new t(n.sumCollateral.toString()),e.abrupt("return",o.dividedBy(a));case 6:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),o.sneakAccounts=function(){var e=O(G.mark((function e(t,n){var o,a,i,u,s,c,p,d,h,w,m,v,y,b,g,k,x,A=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=r.BigNumber.from(10).pow(18),a=r.BigNumber.from(10).pow(9),i=this.env.getContract(L.misc.oracle,f.abi),u=n.map((function(e){return A.env.getContract(e,l.abi)})),e.next=6,i.getUnderlyingPrices(n);case 6:return s=e.sent,e.next=9,this.env.auriInternalLens.callStatic.getExchangeRates(n);case 9:c=e.sent,p=[],d=M(t);case 12:if((h=d()).done){e.next=33;break}w=h.value,m=[],v=0;case 16:if(!(v<u.length)){e.next=30;break}return e.next=19,u[v].getAccountSnapshot(w);case 19:if(b=(y=e.sent)[0].mul(c[v]).div(o).mul(s[v]).div(o),g=y[1].mul(s[v]).div(o),k=b.div(a).toNumber()/Math.pow(10,9),x=g.div(a).toNumber()/Math.pow(10,9),!(k<.1||x<.1)){e.next=26;break}return e.abrupt("continue",27);case 26:m.push({token:re(n[v]),deposit:k,borrow:x});case 27:++v,e.next=16;break;case 30:p.push(m);case 31:e.next=12;break;case 33:return e.abrupt("return",p);case 34:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),n}(j),vt=function(e){function t(t){var n;return(n=e.call(this,t)||this).referral=new r.Contract(L.misc.REFERRAL,g.abi,t.provider),n}I(t,e);var n=t.prototype;return n.generateReferralCode=function(){for(var e="abcdefghijklmnopqrstuvwxyz",t=e+e.toUpperCase()+"1234567890",r="",n=0;n<10;n++)r+=t[Math.floor(Math.random()*t.length)];return r},n.getUserReferralCode=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.referral.userReferralCode(t);case 2:return e.abrupt("return",r.ethers.utils.parseBytes32String(e.sent));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.getReferralCodeUsed=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.referral.referralCodeUsed(t);case 2:return e.abrupt("return",r.ethers.utils.parseBytes32String(e.sent));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.getReferralCodeOwner=function(){var e=O(G.mark((function e(t){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.ethers.utils.formatBytes32String(t),e.abrupt("return",this.referral.referralCodeOwner(n));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(j),yt=function(e){function t(){return e.apply(this,arguments)||this}I(t,e);var n=t.prototype;return n.registerNewReferralCode=function(){var e=O(G.mark((function e(){var t;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.ethers.utils.formatBytes32String(this.generateReferralCode()),e.abrupt("return",this.referral.connect(this._networkConnection.signer).registerNewUserReferralCode(t));case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),n.useReferralCode=function(){var e=O(G.mark((function e(t){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.ethers.utils.formatBytes32String(t),e.abrupt("return",this.referral.connect(this._networkConnection.signer).registerReferralCodeUsed(n));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(vt),bt=function(e){function t(){return e.call(this)||this}I(t,e);var r=t.prototype;return r.read=function(e){return new vt(e)},r.readWrite=function(e){return new yt(e)},t}(q),gt=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new H(t),r._stakingRead=new dt(t),r._misc=new mt(t),r}I(t,e);var r=t.prototype;return r.getUserDetails=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._misc.getUserDetails(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.getPLYWNEARPoolDetails=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._stakingRead.getPLYWNEARPoolDetails());case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.getTokenPrice=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._misc.getTokenPrice(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.stakeBalanceOf=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._stakingRead.stakeBalanceOf(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.LpBalanceOf=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._stakingRead.LpBalanceOf(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.unclaimedRewardsOf=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._stakingRead.unclaimedRewardsOf(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.calcHypotheticalStats=function(e){return this._misc.calcHypotheticalStats({userMarketDetail:e.userMarketDetail,currentBorrowLimit:e.currentBorrowLimit,currentBorrowValuation:e.currentBorrowValuation,action:e.action,tokenAmount:e.tokenAmount})},r.getPlyCirculatingSupply=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._misc.getPlyCirculatingSupply());case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.getUltilizations=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._misc.getUltilizations(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.sneakAccounts=function(){var e=O(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._misc.sneakAccounts(t,r));case 1:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t}(j),kt=function(e){function t(){return e.apply(this,arguments)||this}I(t,e);var r=t.prototype;return r.claim=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=this.env.comptroller.connect(this._networkConnection.signer),e.next=3,this._networkConnection.signer.getAddress();case 3:return e.t1=e.sent,e.abrupt("return",e.t0["claimReward(uint8,address)"].call(e.t0,0,e.t1));case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.claimLpRewards=function(){var e=O(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=this.env.auriFairLaunch.connect(this._networkConnection.signer),e.next=3,this._networkConnection.signer.getAddress();case 3:return e.t1=e.sent,e.t2=T,e.abrupt("return",e.t0.harvest.call(e.t0,e.t1,0,e.t2));case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.stake=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new ht(this._networkConnection).stake(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.unstake=function(){var e=O(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new ht(this._networkConnection).unstake(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(gt),xt=function(e){function t(){return e.call(this)||this}I(t,e);var r=t.prototype;return r.read=function(e){return new gt(e)},r.readWrite=function(e){return new kt(e)},t}(q);r.ethers.utils.Logger.setLogLevel(n.Logger.levels.ERROR),t.config({DECIMAL_PLACES:50}),exports.MAINNET_ADDRESSES=o,exports.TESTNET_ADDRESSES=a,exports.AIRDROP_END_TIMESTAMP=1651068e3,exports.AIRDROP_KEEP_THRESHOLD=604800,exports.AIRDROP_START_TIMESTAMP=1649858400,exports.ALL_STAKING_POOLS=P,exports.AURORA_CHAINID=1313161554,exports.Airdrop=ot,exports.AirdropRead=rt,exports.AirdropReadWrite=nt,exports.AuriEnv=H,exports.BORROW_LIMIT_BUFFER=R,exports.BORROW_NEAR_REWARDS_PER_WEEK=B,exports.BlockchainEntity=q,exports.BlockchainEntityRead=j,exports.BlockchainEntityReadWrite=Y,exports.DECIMAL_PRECISION=10,exports.DEPOSIT_NEAR_REWARDS_PER_WEEK=S,exports.ETHAddress=A,exports.HARDCODE_PRICE_TOKENS=_,exports.INF=T,exports.MiscRead=mt,exports.MoneyMarket=ut,exports.MoneyMarketRead=at,exports.MoneyMarketReadWrite=it,exports.ONE_DAY=86400,exports.ONE_WEEK=604800,exports.ONE_YEAR=31536e3,exports.PLYToken=pe,exports.PLYWNEARToken=fe,exports.PLYWNEAR_POOL_ID=0,exports.PLYWNEAR_REWARD_TOKENS=C,exports.PRICE_WHITELISTED=E,exports.Papermill=lt,exports.PapermillRead=pt,exports.PapermillReadWrite=ft,exports.REWARD_CLAIM_START=1651759200,exports.Referral=bt,exports.ReferralRead=vt,exports.ReferralReadWrite=yt,exports.SDK=xt,exports.SdkRead=gt,exports.SdkReadWrite=kt,exports.Staking=wt,exports.StakingRead=dt,exports.StakingReadWrite=ht,exports.Token=ce,exports.TokenAmount=le,exports.TransferEventQuery=et,exports.assert=Q,exports.calcLMRewardApr=ne,exports.calcValuation=Qe,exports.decimalFactor=J,exports.decimalRecords=N,exports.devLog=se,exports.dummyAddress="0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE",exports.dummyMarketAddress="0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f",exports.dummyPly=he,exports.dummyPlyAurora=we,exports.dummyToken=de,exports.dummyTokenAmount=me,exports.dummyTokenAmount2=ye,exports.dummyTokenAmount3=be,exports.dummyUserMarketDetails=ge,exports.dummyZeroTokenAmount=ve,exports.fetchLPPositions=Ee,exports.fetchLPPrice=Ce,exports.fetchPLYPrice=je,exports.fetchPULPPrice=qe,exports.fetchPrice=Me,exports.fetchPriceFromCoingecko=Ae,exports.fetchPriceFromCoingeckoAPI=ke,exports.fetchPriceFromOracle=Se,exports.fetchStNEARPrice=De,exports.fetchToken0PriceByLP=Ge,exports.fetchUnderlyingTokensPrices=_e,exports.fetchValuation=Ve,exports.formatObject=Z,exports.getBlockBeforeTimestamp=ie,exports.getBlockTimestamp=oe,exports.getCurrentTimestamp=X,exports.getDecimal=te,exports.getQuery=V,exports.getSymbol=re,exports.isSameAddress=$,exports.networkAddresses=L,exports.symbolRecords=K,exports.validateAndParseAddress=ee,exports.valuateToken=Ze;
|
|
2
2
|
//# sourceMappingURL=sdk.cjs.production.min.js.map
|