@aurigami/sdk 1.6.5 → 1.6.6

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.
@@ -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/PULP.sol/PULP.json")),y=e(require("@aurigami/contracts/artifacts/contracts/ReferralDirectory.sol/ReferralDirectory.json")),b=require("@ethersproject/abstract-signer"),k=e(require("axios")),g=e(require("@aurigami/contracts/artifacts/contracts/AuToken.sol/AuToken.json")),x="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",A={auTokens:[{name:"auUSDC",address:o.auTokens.USDC.toLowerCase(),underlying:"0xb12bfca5a55806aaf64e99521918a4bf0fc40802".toLowerCase()},{name:"auETH",address:o.auTokens.ETH.toLowerCase(),underlying:x.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()}},E=new Set([].concat(A.auTokens.map((function(e){return e.underlying})),[A.tokens.AURORA,A.tokens.TRI,A.tokens.META,A.tokens.stNEAR])),L=new t(1),R=["0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f","0x04Ac48711BCdc45b4d223fb021E09DA73c71095e","0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d","0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30","0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79","0xFa94348467f64D5A457F75F8bc40495D33c65aBB"],C=[0],P=r.BigNumber.from(2).pow(256).sub(1),T=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]}))),S={},B=Object.fromEntries([[A.tokens.USN.toLowerCase(),"1"]]),_={"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 N(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 D(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){N(a,n,o,i,u,"next",e)}function u(e){N(a,n,o,i,u,"throw",e)}i(void 0)}))}}function O(){return(O=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 U(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 I(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 F(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 I(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)?I(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,M=function(e){this._networkConnection=e},j=function(e){function t(t){if(!(t.signer instanceof b.Signer))throw Error("Signer is not provided when constructing BlockchainEntityReadWrite");return e.call(this,t)||this}return U(t,e),t}(M),Y=function(){function e(){}var t=e.prototype;return t.read=function(e){return new M(e)},t.readWrite=function(e){return new j(e)},e}(),q=function(e){function t(t){var r;return(r=e.call(this,t)||this).comptroller=r.getContract(A.misc.COMPTROLLER,l.abi),r.auriFairLaunch=r.getContract(A.misc.AURIFAIRLAUNCH,c.abi),r.auriLens=r.getContract(A.misc.AURILENS,p.abi),r.ply=r.getContract(A.tokens.PLY,h.abi),r.pulp=r.getContract(A.tokens.PULP,v.abi),r}return U(t,e),t.prototype.getContract=function(e,t){return new r.Contract(e,t,this._networkConnection.provider)},t}(M),H=(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=k(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 k(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,k(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 g(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(g,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)}}(W={exports:{}}),W.exports);function G(e,t,r){return K.apply(this,arguments)}function K(){return(K=D(H.mark((function e(t,r,n){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n&&(n={}),n=O({},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 V(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 z=function(e,t){return e.toLowerCase()==t.toLowerCase()},J=function(){return Math.trunc(Date.now()/1e3)};function $(e){try{return r.utils.getAddress(e)}catch(t){throw new Error("Invalid address: "+e)}}function X(e){var t=e.toLowerCase();return V(null!=_[t],"Decimal not found for "+e),_[t]}function ee(e,r,n){return e.isZero()?new t(0):r.lte(0)?e:e.multipliedBy(n).dividedBy(r)}function te(e,t){return re.apply(this,arguments)}function re(){return(re=D(H.mark((function e(t,r){return H.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 ne(e,t){return oe.apply(this,arguments)}function oe(){return(oe=D(H.mark((function e(t,r){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,G("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 ae(e){}var ie=function(e,t){this.address=e.toLowerCase(),this.decimals=t},ue=new ie(A.tokens.PLY,X(A.tokens.PLY)),se=new ie(A.tokens.PLYWNEAR,X(A.tokens.PLYWNEAR)),ce=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 ie(t,X(t)),r,n)},e}(),pe=new ie("0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",6),fe=new ie("0x8729438eb15e2c8b576fcc6aecda6a148776c0f5",18),le=new ie("0xE530dC2095Ef5653205CF5ea79F8979a7028065c",18),de=new ce(pe,"123.456",!1),he=new ce(pe,"0"),we=new ce(pe,"456.123",!1),me=new ce(pe,"1000.123",!1),ve={market:"0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f",depositBalance:we,borrowBalance:he,isCollateral:!0,maxWithdrawableAmount:de,collateralRatio:.5,underlyingPrice:"1"};function ye(e){return be.apply(this,arguments)}function be(){return(be=D(H.mark((function e(r){return H.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 ge.apply(this,arguments)}function ge(){return(ge=D(H.mark((function e(t){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t.toLowerCase(),e.next=e.t0===A.tokens.AURORA?3:e.t0===A.tokens.TRI?4:e.t0===A.tokens.META?5:6;break;case 3:return e.abrupt("return",ye("aurora-near"));case 4:return e.abrupt("return",ye("trisolaris"));case 5:return e.abrupt("return",ye("meta-pool"));case 6:throw Error("Unknown token "+t+" in fetchPriceFromCoingecko");case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xe(e,t){return Ae.apply(this,arguments)}function Ae(){return(Ae=D(H.mark((function e(t,n){var o,a,i;return H.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 Ee(e,t){return Le.apply(this,arguments)}function Le(){return(Le=D(H.mark((function e(r,n){var o,a,i,u;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=function(){return(u=D(H.mark((function e(r){var i,u,s;return H.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,De(r.address,n);case 4:return i=e.sent,u=X(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,xe(r,n);case 4:return o=e.sent,a=X(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 Ce(e,t,r){return Pe.apply(this,arguments)}function Pe(){return(Pe=D(H.mark((function e(t,n,o){var a;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=new r.Contract(A.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 Te(e){return Se.apply(this,arguments)}function Se(){return(Se=D(H.mark((function e(t){var n,o,a;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new r.Contract(A.misc.AURILENS,p.abi,t),o=A.auTokens.map((function(e){return e.address})),a=A.auTokens.map((function(e){return X(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 Be(){return _e.apply(this,arguments)}function _e(){return(_e=D(H.mark((function e(){var r,n,o,a,i;return H.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=ye("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 Ne(e){return(e=e.toLowerCase())==A.tokens.AURORA||e==A.tokens.TRI||e==A.tokens.META}function De(e,t){return Oe.apply(this,arguments)}function Oe(){return(Oe=D(H.mark((function e(t,r){var n;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V(E.has(t.toLocaleLowerCase()),"Address "+t+" is not whitelisted for price fetching"),!z(t,A.tokens.stNEAR)){e.next=3;break}return e.abrupt("return",Be());case 3:if(!Ne(t)){e.next=5;break}return e.abrupt("return",ke(t));case 5:if(void 0===(n=A.auTokens.find((function(e){return z(e.underlying,t)})))){e.next=10;break}return e.abrupt("return",Ce(n.address,X(t),r));case 10:throw Error("Unable to fetch price for "+t);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ue(e,t){return Ie.apply(this,arguments)}function Ie(){return(Ie=D(H.mark((function e(r,n){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.toLowerCase()in B)){e.next=4;break}return e.abrupt("return",new t(B[r.toLowerCase()]));case 4:if(!z(r,A.tokens.PLYWNEAR)){e.next=8;break}return e.abrupt("return",Ee(r,n));case 8:if(!z(r,A.tokens.PLY)){e.next=12;break}return e.abrupt("return",Fe(n));case 12:if(!z(r,A.tokens.PULP)){e.next=14;break}return e.abrupt("return",Me(n));case 14:return e.abrupt("return",De(r,n));case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fe(e){return We.apply(this,arguments)}function We(){return(We=D(H.mark((function e(t){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Ye(A.tokens.PLYWNEAR,t));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Me(e){return je.apply(this,arguments)}function je(){return(je=D(H.mark((function e(r){return H.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 Ye(e,t){return qe.apply(this,arguments)}function qe(){return(qe=D(H.mark((function e(r,n){var o,a,i;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,xe(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=X(o.token0),i=X(o.token1),e.next=9,Ue(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 He(e,t){return Ge.apply(this,arguments)}function Ge(){return(Ge=D(H.mark((function e(r,n){return H.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,Ue(r.token.address,n);case 4:return e.abrupt("return",Ke(r,e.sent));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ke(e,r){return new t(e.formattedAmount()).multipliedBy(r)}function Ve(e,t){return Qe.apply(this,arguments)}function Qe(){return(Qe=D(H.mark((function e(t,r){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,He(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,ze,Je=function(e){function t(t,n){var o;return(o=e.call(this,n)||this).auToken=new r.Contract(t,g.abi,o._networkConnection.provider),o}U(t,e);var n=t.prototype;return n.queryERC20TransfersOf=function(){var e=D(H.mark((function e(t,r,n){var o,a,i,u=this;return H.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=D(H.mark((function e(t,r){return H.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}(M),$e={__proto__:null,getQuery:G,assert:V,formatObject:Q,decimalFactor:Z,isSameAddress:z,getCurrentTimestamp:J,validateAndParseAddress:$,getDecimal:X,calcLMRewardApr:ee,getBlockTimestamp:te,getBlockBeforeTimestamp:ne,devLog:ae,fetchPriceFromCoingeckoAPI:ye,fetchPriceFromCoingecko:ke,fetchLPPositions:xe,fetchLPPrice:Ee,fetchPriceFromOracle:Ce,fetchUnderlyingTokensPrices:Te,fetchStNEARPrice:Be,fetchPrice:Ue,fetchPLYPrice:Fe,fetchPULPPrice:Me,fetchToken0PriceByLP:Ye,fetchValuation:He,calcValuation:Ke,valuateToken:Ve,TransferEventQuery:Je},Xe=function(e){function t(t){var n;return(n=e.call(this,t)||this)._airDrop=new r.Contract(A.misc.AURI_AIRDROP,s.abi,t.provider),n}return U(t,e),t.prototype.getRedeemableReward=function(){var e=D(H.mark((function e(t,n,o){var a;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=new ie(n,X(n)),e.next=3,this._airDrop.getRedeemableReward(r.utils.formatBytes32String(t),n,o);case 3:return e.abrupt("return",new ce(a,e.sent.toString()));case 5:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),t}(M),et=function(e){function t(){return e.apply(this,arguments)||this}U(t,e);var n=t.prototype;return n.redeemMultiple=function(){var e=D(H.mark((function e(t,n){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V(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=D(H.mark((function e(t,r){return H.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}(Xe),tt=function(e){function t(){return e.call(this)||this}U(t,e);var r=t.prototype;return r.read=function(e){return new Xe(e)},r.readWrite=function(e){return new et(e)},t}(Y),rt=function(e){function t(t){var n;return(n=e.call(this,t)||this)._multicall=new r.Contract(A.misc.MULTICALL,m.abi,t.provider),n}return U(t,e),t.prototype.aggregate=function(){var e=D(H.mark((function e(t){var n,o,a,i,u,s,c,p;return H.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}(M);(Ze=exports.ComptrollerRewardType||(exports.ComptrollerRewardType={}))[Ze.PLY=0]="PLY",Ze[Ze.AURORA=1]="AURORA",(ze=exports.MarketAction||(exports.MarketAction={}))[ze.Deposit=0]="Deposit",ze[ze.Borrow=1]="Borrow",ze[ze.Withdraw=2]="Withdraw",ze[ze.Repay=3]="Repay",ze[ze.EnableCollateral=4]="EnableCollateral",ze[ze.DisableCollateral=5]="DisableCollateral";var nt=function(e){function n(t){var r;return(r=e.call(this,t)||this)._stakingRead=new ht(t),r.env=new q(t),r}U(n,e);var o=n.prototype;return o.getUserDetails=function(){var e=D(H.mark((function e(r){var n,o,a,i,u,s,c,p,f,l,d,h,w,m,v,y,b,k,g,x,E,R=this;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(n=A.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 ot(R._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(Ue(n.underlying.address,R._networkConnection.provider).then((function(e){return t.underlyingPrice=e.toString(),e})))},p=F(A.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=A.auTokens[w];o[w].isCollateral=void 0!==a.find((function(t){return z(e.address,t)})),d.push(Ke(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(L),y=m.div(L),b=v.lte(m)?new t(0):v.minus(m),w=0;w<n;w++)g=new ot(this._networkConnection,(k=A.auTokens[w]).address,k.underlying),x=u.minus(y).gt(0)?u.minus(y):new t(0),E=x.div(o[w].collateralRatio).div(l[w]),o[w].maxWithdrawableAmount=o[w].isCollateral&&E.lt(o[w].depositBalance.formattedAmount())?new ce(g.underlying,E.toFixed(24),!1):new ce(g.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=D(H.mark((function e(t){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ue(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=Ke(r.depositBalance,new t(r.underlyingPrice)).multipliedBy(r.collateralRatio).multipliedBy(L);i=o==exports.MarketAction.EnableCollateral?i.plus(s):i.minus(s);break;case exports.MarketAction.Deposit:case exports.MarketAction.Withdraw:s=Ke(a,new t(r.underlyingPrice)).multipliedBy(r.collateralRatio).multipliedBy(L),i=o==exports.MarketAction.Deposit?i.plus(s):i.minus(s);break;case exports.MarketAction.Borrow:case exports.MarketAction.Repay:var c=Ke(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=D(H.mark((function e(){var t,n,o,a;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new rt(this._networkConnection),n={contract:this.env.ply,method:"balanceOf",returnTypes:["uint256"]},e.next=4,t.aggregate([O({},n,{method:"totalSupply",args:[]}),O({},n,{args:[A.misc.TEAM_MULTISIG]}),O({},n,{args:[A.misc.COMPTROLLER]}),O({},n,{args:[A.misc.AURIFAIRLAUNCH]}),O({},n,{args:[A.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 ce(ue,a.toString()));case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),n}(M),ot=function(e){function n(t,n,o){var a;return(a=e.call(this,t)||this).env=new q(t),a.auToken=z(o,x)?new r.Contract(n,u.abi,t.provider):new r.Contract(n,i.abi,t.provider),a.underlying=new ie(o,X(o)),a}U(n,e);var o=n.prototype;return o.getRewardSpeeds=function(){var e=D(H.mark((function e(){return H.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=D(H.mark((function e(){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=ce,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=D(H.mark((function e(){var t,n,o,a=this;return H.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 ce(a.underlying,e.toString())}))),e.next=5,Promise.all(t);case 5:return e.abrupt("return",new ce(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=D(H.mark((function e(){return H.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=D(H.mark((function e(){return H.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=D(H.mark((function e(){return H.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=D(H.mark((function e(){var t,r,n,o,a;return H.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 ce(ue,e.toString())}))),t.push(Ue(A.tokens.PLY,this._networkConnection.provider).then((function(e){o=e}))),t.push(Ue(this.underlying.address,this._networkConnection.provider).then((function(e){a=e}))),e.next=7,Promise.all(t);case 7:return e.abrupt("return",ee(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=D(H.mark((function e(){var t,r,n,o,a;return H.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 ce(ue,e.toString())}))),t.push(Ue(A.tokens.PLY,this._networkConnection.provider).then((function(e){o=e}))),t.push(Ue(this.underlying.address,this._networkConnection.provider).then((function(e){a=e}))),e.next=7,Promise.all(t);case 7:return e.abrupt("return",ee(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=D(H.mark((function e(){var r,n,o,a,i,u,s,c,p,f,l,d,h,w;return H.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(Ue(A.tokens.PLY,this._networkConnection.provider).then((function(e){s=e}))),r.push(Ue(this.underlying.address,this._networkConnection.provider).then((function(e){c=e}))),e.next=11,Promise.all(r);case 11:return f=ee(Ke(new ce(ue,p.plyRewardBorrowSpeed.toString()),s),c.multipliedBy(o.formattedAmount()),31536e3),l=ee(Ke(new ce(ue,p.plyRewardSupplySpeed.toString()),s),c.multipliedBy(n.formattedAmount()),31536e3),e.t0=$e,e.next=16,He(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=$e,e.next=22,He(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=z(this.underlying.address,A.tokens.stNEAR)?ee(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 ce(ue,p.plyRewardSupplySpeed.mul(86400).mul(7).toString()),borrowPlyPerWeek:new ce(ue,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=D(H.mark((function e(t){return H.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 ce(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=D(H.mark((function e(t){return H.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 ce(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 ie(A.tokens.WNEAR,X(A.tokens.WNEAR)),t=J();if(t<=1651845600&&t>1650636e3){var r,n=null!=(r=T[this.underlying.address.toLocaleLowerCase()])?r:"0";return new ce(e,n,!1)}return new ce(e,"0")},o.getBorrowNEARRewardPerWeek=function(){var e=new ie(A.tokens.WNEAR,X(A.tokens.WNEAR)),t=J();if(t<=1651845600&&t>1650636e3){var r,n=null!=(r=S[this.underlying.address.toLocaleLowerCase()])?r:"0";return new ce(e,n,!1)}return new ce(e,"0")},n}(M),at=function(e){function n(t,n,o){var a;return(a=e.call(this,t,n,o)||this)._EthRepayHelper=new r.Contract(A.misc.ETHREPAYHELPER,d.abi,t.provider),a}U(n,e);var o=n.prototype;return o.deposit=function(){var e=D(H.mark((function e(t){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!z(t.token.address,x)){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=D(H.mark((function e(t){return H.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=D(H.mark((function e(r){return H.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(P));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=D(H.mark((function e(r){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!z(r.token.address,x)){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(P));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=D(H.mark((function e(){return H.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=D(H.mark((function e(){return H.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}(ot),it=function(e){function t(t,r){var n;return(n=e.call(this)||this).address=$(t),n.underlying=$(r),n}U(t,e);var r=t.prototype;return r.read=function(e){return new ot(e,this.address,this.underlying)},r.readWrite=function(e){return new at(e,this.address,this.underlying)},t}(Y),ut=r.BigNumber.from(1e4),st=function(e){function n(t){var r;(r=e.call(this,t)||this).env=new q(t);var n=A.tokens.PLY,o=A.tokens.PULP;return r.plyToken=new ie(n,X(n)),r.pulpToken=new ie(o,X(o)),r}U(n,e);var o=n.prototype;return o.getPlyBalance=function(){var e=D(H.mark((function e(t){return H.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 ce(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=D(H.mark((function e(t){return H.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 ce(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=D(H.mark((function e(t){return H.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,C,{from:t});case 2:return e.abrupt("return",new ce(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=D(H.mark((function e(n){var o,a,i,u,s,c,p,f,l,d,h,w,m;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=this.getWeek(J()),(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 ce(this.plyToken,l.toString()),currentPulp:new ce(this.pulpToken,f.toString()),nextUnlockPortion:new t(m).dividedBy(100).toNumber(),nextPly:new ce(this.plyToken,d.toString()),nextPulp:new ce(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=D(H.mark((function e(t,r){return H.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(J())+1)},o.getUnlockPortionAt=function(){var e=D(H.mark((function e(t,r){var n;return H.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}(M),ct=function(e){function t(t){return e.call(this,t)||this}U(t,e);var r=t.prototype;return r.redeem=function(){var e=D(H.mark((function e(t,r){return H.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=D(H.mark((function e(t){return H.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}U(t,e);var r=t.prototype;return r.read=function(e){return new st(e)},r.readWrite=function(e){return new ct(e)},t}(Y),ft=function(e){function t(t){var n;return(n=e.call(this,t)||this)._referral=new r.Contract(A.misc.REFERRAL,y.abi,t.provider),n}U(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=D(H.mark((function e(t){return H.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=D(H.mark((function e(t){return H.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=D(H.mark((function e(t){var n;return H.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}(M),lt=function(e){function t(){return e.apply(this,arguments)||this}U(t,e);var n=t.prototype;return n.registerNewReferralCode=function(){var e=D(H.mark((function e(){var t;return H.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=D(H.mark((function e(t){var n;return H.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}(ft),dt=function(e){function t(){return e.call(this)||this}U(t,e);var r=t.prototype;return r.read=function(e){return new ft(e)},r.readWrite=function(e){return new lt(e)},t}(Y),ht=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new q(t),r}U(t,e);var n=t.prototype;return n.getPLYWNEARPoolDetails=function(){var e=D(H.mark((function e(){var t,r,n,o,a,i,u,s,c;return H.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 ce(se,t.toString()),e.next=5,He(n,this._networkConnection.provider);case 5:for(o=e.sent,a=[],i=0;i<r.length;i++)s=new ie(u=R[i],X(u)),a.push(He(new ce(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=ee(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=D(H.mark((function e(t){return H.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 ce(se,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=D(H.mark((function e(t){var n;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new r.Contract(A.tokens.PLYWNEAR,h.abi,this._networkConnection.provider),e.next=3,n.balanceOf(t);case 3:return e.abrupt("return",new ce(se,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=D(H.mark((function e(t){return H.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 ce.fromAddressAndAmount(R[t],e.toString())})));case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(M),wt=function(e){function t(){return e.apply(this,arguments)||this}U(t,e);var n=t.prototype;return n.stake=function(){var e=D(H.mark((function e(t){return H.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=D(H.mark((function e(t){var n,o,a,i;return H.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}(ht),mt=function(e){function t(){return e.call(this)||this}U(t,e);var r=t.prototype;return r.read=function(e){return new ht(e)},r.readWrite=function(e){return new wt(e)},t}(Y),vt=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new q(t),r._stakingRead=new ht(t),r._misc=new nt(t),r}U(t,e);var r=t.prototype;return r.getUserDetails=function(){var e=D(H.mark((function e(t){return H.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=D(H.mark((function e(){return H.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=D(H.mark((function e(t){return H.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=D(H.mark((function e(t){return H.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=D(H.mark((function e(t){return H.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=D(H.mark((function e(t){return H.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=D(H.mark((function e(){return H.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)}}(),t}(M),yt=function(e){function t(){return e.apply(this,arguments)||this}U(t,e);var r=t.prototype;return r.claim=function(){var e=D(H.mark((function e(){return H.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=D(H.mark((function e(){return H.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=P,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=D(H.mark((function e(t){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new wt(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=D(H.mark((function e(t){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new wt(this._networkConnection).unstake(t));case 1: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}U(t,e);var r=t.prototype;return r.read=function(e){return new vt(e)},r.readWrite=function(e){return new yt(e)},t}(Y);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=C,exports.AURORA_CHAINID=1313161554,exports.Airdrop=tt,exports.AirdropRead=Xe,exports.AirdropReadWrite=et,exports.AuriEnv=q,exports.BORROW_LIMIT_BUFFER=L,exports.BORROW_NEAR_REWARDS_PER_WEEK=S,exports.BlockchainEntity=Y,exports.BlockchainEntityRead=M,exports.BlockchainEntityReadWrite=j,exports.DECIMAL_PRECISION=10,exports.DEPOSIT_NEAR_REWARDS_PER_WEEK=T,exports.ETHAddress=x,exports.HARDCODE_PRICE_TOKENS=B,exports.INF=P,exports.MiscRead=nt,exports.MoneyMarket=it,exports.MoneyMarketRead=ot,exports.MoneyMarketReadWrite=at,exports.ONE_DAY=86400,exports.ONE_WEEK=604800,exports.ONE_YEAR=31536e3,exports.PLYToken=ue,exports.PLYWNEARToken=se,exports.PLYWNEAR_POOL_ID=0,exports.PLYWNEAR_REWARD_TOKENS=R,exports.PRICE_WHITELISTED=E,exports.Papermill=pt,exports.PapermillRead=st,exports.PapermillReadWrite=ct,exports.REWARD_CLAIM_START=1651759200,exports.Referral=dt,exports.ReferralRead=ft,exports.ReferralReadWrite=lt,exports.SDK=bt,exports.SdkRead=vt,exports.SdkReadWrite=yt,exports.Staking=mt,exports.StakingRead=ht,exports.StakingReadWrite=wt,exports.Token=ie,exports.TokenAmount=ce,exports.TransferEventQuery=Je,exports.assert=V,exports.calcLMRewardApr=ee,exports.calcValuation=Ke,exports.decimalFactor=Z,exports.decimalRecords=_,exports.devLog=ae,exports.dummyAddress="0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE",exports.dummyMarketAddress="0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f",exports.dummyPly=fe,exports.dummyPlyAurora=le,exports.dummyToken=pe,exports.dummyTokenAmount=de,exports.dummyTokenAmount2=we,exports.dummyTokenAmount3=me,exports.dummyUserMarketDetails=ve,exports.dummyZeroTokenAmount=he,exports.fetchLPPositions=xe,exports.fetchLPPrice=Ee,exports.fetchPLYPrice=Fe,exports.fetchPULPPrice=Me,exports.fetchPrice=Ue,exports.fetchPriceFromCoingecko=ke,exports.fetchPriceFromCoingeckoAPI=ye,exports.fetchPriceFromOracle=Ce,exports.fetchStNEARPrice=Be,exports.fetchToken0PriceByLP=Ye,exports.fetchUnderlyingTokensPrices=Te,exports.fetchValuation=He,exports.formatObject=Q,exports.getBlockBeforeTimestamp=ne,exports.getBlockTimestamp=te,exports.getCurrentTimestamp=J,exports.getDecimal=X,exports.getQuery=G,exports.isSameAddress=z,exports.networkAddresses=A,exports.validateAndParseAddress=$,exports.valuateToken=Ve;
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/PULP.sol/PULP.json")),y=e(require("@aurigami/contracts/artifacts/contracts/ReferralDirectory.sol/ReferralDirectory.json")),b=require("@ethersproject/abstract-signer"),k=e(require("axios")),g=e(require("@aurigami/contracts/artifacts/contracts/AuToken.sol/AuToken.json")),x="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",A={auTokens:[{name:"auUSDC",address:o.auTokens.USDC.toLowerCase(),underlying:"0xb12bfca5a55806aaf64e99521918a4bf0fc40802".toLowerCase()},{name:"auETH",address:o.auTokens.ETH.toLowerCase(),underlying:x.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()}},E=new Set([].concat(A.auTokens.map((function(e){return e.underlying})),[A.tokens.AURORA,A.tokens.TRI,A.tokens.META,A.tokens.stNEAR])),L=new t(1),R=["0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f","0x04Ac48711BCdc45b4d223fb021E09DA73c71095e","0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d","0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30","0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79","0xFa94348467f64D5A457F75F8bc40495D33c65aBB"],C=[0],P=r.BigNumber.from(2).pow(256).sub(1),T=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]}))),S={},B=Object.fromEntries([[A.tokens.USN.toLowerCase(),"1"]]),_={"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 N(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 D(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){N(a,n,o,i,u,"next",e)}function u(e){N(a,n,o,i,u,"throw",e)}i(void 0)}))}}function O(){return(O=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 U(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 I(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 F(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 I(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)?I(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,M=function(e){this._networkConnection=e},j=function(e){function t(t){if(!(t.signer instanceof b.Signer))throw Error("Signer is not provided when constructing BlockchainEntityReadWrite");return e.call(this,t)||this}return U(t,e),t}(M),Y=function(){function e(){}var t=e.prototype;return t.read=function(e){return new M(e)},t.readWrite=function(e){return new j(e)},e}(),q=function(e){function t(t){var r;return(r=e.call(this,t)||this).comptroller=r.getContract(A.misc.COMPTROLLER,l.abi),r.auriFairLaunch=r.getContract(A.misc.AURIFAIRLAUNCH,c.abi),r.auriLens=r.getContract(A.misc.AURILENS,p.abi),r.ply=r.getContract(A.tokens.PLY,h.abi),r.pulp=r.getContract(A.tokens.PULP,v.abi),r}return U(t,e),t.prototype.getContract=function(e,t){return new r.Contract(e,t,this._networkConnection.provider)},t}(M),H=(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=k(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 k(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,k(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 g(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(g,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)}}(W={exports:{}}),W.exports);function G(e,t,r){return K.apply(this,arguments)}function K(){return(K=D(H.mark((function e(t,r,n){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n&&(n={}),n=O({},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 V(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 z=function(e,t){return e.toLowerCase()==t.toLowerCase()},J=function(){return Math.trunc(Date.now()/1e3)};function $(e){try{return r.utils.getAddress(e)}catch(t){throw new Error("Invalid address: "+e)}}function X(e){var t=e.toLowerCase();return V(null!=_[t],"Decimal not found for "+e),_[t]}function ee(e,r,n){return e.isZero()?new t(0):r.lte(0)?e:e.multipliedBy(n).dividedBy(r)}function te(e,t){return re.apply(this,arguments)}function re(){return(re=D(H.mark((function e(t,r){return H.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 ne(e,t){return oe.apply(this,arguments)}function oe(){return(oe=D(H.mark((function e(t,r){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,G("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 ae(e){}var ie=function(e,t){this.address=e.toLowerCase(),this.decimals=t},ue=new ie(A.tokens.PLY,X(A.tokens.PLY)),se=new ie(A.tokens.PLYWNEAR,X(A.tokens.PLYWNEAR)),ce=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 ie(t,X(t)),r,n)},e}(),pe=new ie("0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",6),fe=new ie("0x8729438eb15e2c8b576fcc6aecda6a148776c0f5",18),le=new ie("0xE530dC2095Ef5653205CF5ea79F8979a7028065c",18),de=new ce(pe,"123.456",!1),he=new ce(pe,"0"),we=new ce(pe,"456.123",!1),me=new ce(pe,"1000.123",!1),ve={market:"0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f",depositBalance:we,borrowBalance:he,isCollateral:!0,maxWithdrawableAmount:de,collateralRatio:.5,underlyingPrice:"1"};function ye(e){return be.apply(this,arguments)}function be(){return(be=D(H.mark((function e(r){return H.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 ge.apply(this,arguments)}function ge(){return(ge=D(H.mark((function e(t){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t.toLowerCase(),e.next=e.t0===A.tokens.AURORA?3:e.t0===A.tokens.TRI?4:e.t0===A.tokens.META?5:6;break;case 3:return e.abrupt("return",ye("aurora-near"));case 4:return e.abrupt("return",ye("trisolaris"));case 5:return e.abrupt("return",ye("meta-pool"));case 6:throw Error("Unknown token "+t+" in fetchPriceFromCoingecko");case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xe(e,t){return Ae.apply(this,arguments)}function Ae(){return(Ae=D(H.mark((function e(t,n){var o,a,i;return H.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 Ee(e,t){return Le.apply(this,arguments)}function Le(){return(Le=D(H.mark((function e(r,n){var o,a,i,u;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=function(){return(u=D(H.mark((function e(r){var i,u,s;return H.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,De(r.address,n);case 4:return i=e.sent,u=X(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,xe(r,n);case 4:return o=e.sent,a=X(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 Ce(e,t,r){return Pe.apply(this,arguments)}function Pe(){return(Pe=D(H.mark((function e(t,n,o){var a;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=new r.Contract(A.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 Te(e){return Se.apply(this,arguments)}function Se(){return(Se=D(H.mark((function e(t){var n,o,a;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new r.Contract(A.misc.AURILENS,p.abi,t),o=A.auTokens.map((function(e){return e.address})),a=A.auTokens.map((function(e){return X(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 Be(){return _e.apply(this,arguments)}function _e(){return(_e=D(H.mark((function e(){var r,n,o,a,i;return H.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=ye("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 Ne(e){return(e=e.toLowerCase())==A.tokens.AURORA||e==A.tokens.TRI||e==A.tokens.META}function De(e,t){return Oe.apply(this,arguments)}function Oe(){return(Oe=D(H.mark((function e(t,r){var n;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V(E.has(t.toLocaleLowerCase()),"Address "+t+" is not whitelisted for price fetching"),!z(t,A.tokens.stNEAR)){e.next=3;break}return e.abrupt("return",Be());case 3:if(!Ne(t)){e.next=5;break}return e.abrupt("return",ke(t));case 5:if(void 0===(n=A.auTokens.find((function(e){return z(e.underlying,t)})))){e.next=10;break}return e.abrupt("return",Ce(n.address,X(t),r));case 10:throw Error("Unable to fetch price for "+t);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ue(e,t){return Ie.apply(this,arguments)}function Ie(){return(Ie=D(H.mark((function e(r,n){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.toLowerCase()in B)){e.next=4;break}return e.abrupt("return",new t(B[r.toLowerCase()]));case 4:if(!z(r,A.tokens.PLYWNEAR)){e.next=8;break}return e.abrupt("return",Ee(r,n));case 8:if(!z(r,A.tokens.PLY)){e.next=12;break}return e.abrupt("return",Fe(n));case 12:if(!z(r,A.tokens.PULP)){e.next=14;break}return e.abrupt("return",Me(n));case 14:return e.abrupt("return",De(r,n));case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fe(e){return We.apply(this,arguments)}function We(){return(We=D(H.mark((function e(t){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Ye(A.tokens.PLYWNEAR,t));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Me(e){return je.apply(this,arguments)}function je(){return(je=D(H.mark((function e(r){return H.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 Ye(e,t){return qe.apply(this,arguments)}function qe(){return(qe=D(H.mark((function e(r,n){var o,a,i;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,xe(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=X(o.token0),i=X(o.token1),e.next=9,Ue(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 He(e,t){return Ge.apply(this,arguments)}function Ge(){return(Ge=D(H.mark((function e(r,n){return H.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,Ue(r.token.address,n);case 4:return e.abrupt("return",Ke(r,e.sent));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ke(e,r){return new t(e.formattedAmount()).multipliedBy(r)}function Ve(e,t){return Qe.apply(this,arguments)}function Qe(){return(Qe=D(H.mark((function e(t,r){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,He(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,ze,Je=function(e){function t(t,n){var o;return(o=e.call(this,n)||this).auToken=new r.Contract(t,g.abi,o._networkConnection.provider),o}U(t,e);var n=t.prototype;return n.queryERC20TransfersOf=function(){var e=D(H.mark((function e(t,r,n){var o,a,i,u=this;return H.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=D(H.mark((function e(t,r){return H.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}(M),$e={__proto__:null,getQuery:G,assert:V,formatObject:Q,decimalFactor:Z,isSameAddress:z,getCurrentTimestamp:J,validateAndParseAddress:$,getDecimal:X,calcLMRewardApr:ee,getBlockTimestamp:te,getBlockBeforeTimestamp:ne,devLog:ae,fetchPriceFromCoingeckoAPI:ye,fetchPriceFromCoingecko:ke,fetchLPPositions:xe,fetchLPPrice:Ee,fetchPriceFromOracle:Ce,fetchUnderlyingTokensPrices:Te,fetchStNEARPrice:Be,fetchPrice:Ue,fetchPLYPrice:Fe,fetchPULPPrice:Me,fetchToken0PriceByLP:Ye,fetchValuation:He,calcValuation:Ke,valuateToken:Ve,TransferEventQuery:Je},Xe=function(e){function t(t){var n;return(n=e.call(this,t)||this).airDrop=new r.Contract(A.misc.AURI_AIRDROP,s.abi,t.provider),n}return U(t,e),t.prototype.getRedeemableReward=function(){var e=D(H.mark((function e(t,n,o){var a;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=new ie(n,X(n)),e.next=3,this.airDrop.getRedeemableReward(r.utils.formatBytes32String(t),n,o);case 3:return e.abrupt("return",new ce(a,e.sent.toString()));case 5:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),t}(M),et=function(e){function t(){return e.apply(this,arguments)||this}U(t,e);var n=t.prototype;return n.redeemMultiple=function(){var e=D(H.mark((function e(t,n){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V(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=D(H.mark((function e(t,r){return H.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}(Xe),tt=function(e){function t(){return e.call(this)||this}U(t,e);var r=t.prototype;return r.read=function(e){return new Xe(e)},r.readWrite=function(e){return new et(e)},t}(Y),rt=function(e){function t(t){var n;return(n=e.call(this,t)||this).multicall=new r.Contract(A.misc.MULTICALL,m.abi,t.provider),n}return U(t,e),t.prototype.aggregate=function(){var e=D(H.mark((function e(t){var n,o,a,i,u,s,c,p;return H.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}(M);(Ze=exports.ComptrollerRewardType||(exports.ComptrollerRewardType={}))[Ze.PLY=0]="PLY",Ze[Ze.AURORA=1]="AURORA",(ze=exports.MarketAction||(exports.MarketAction={}))[ze.Deposit=0]="Deposit",ze[ze.Borrow=1]="Borrow",ze[ze.Withdraw=2]="Withdraw",ze[ze.Repay=3]="Repay",ze[ze.EnableCollateral=4]="EnableCollateral",ze[ze.DisableCollateral=5]="DisableCollateral";var nt=function(e){function n(t){var r;return(r=e.call(this,t)||this).stakingRead=new ht(t),r.env=new q(t),r}U(n,e);var o=n.prototype;return o.getUserDetails=function(){var e=D(H.mark((function e(r){var n,o,a,i,u,s,c,p,f,l,d,h,w,m,v,y,b,k,g,x,E,R=this;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(n=A.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 ot(R._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(Ue(n.underlying.address,R._networkConnection.provider).then((function(e){return t.underlyingPrice=e.toString(),e})))},p=F(A.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=A.auTokens[w];o[w].isCollateral=void 0!==a.find((function(t){return z(e.address,t)})),d.push(Ke(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(L),y=m.div(L),b=v.lte(m)?new t(0):v.minus(m),w=0;w<n;w++)g=new ot(this._networkConnection,(k=A.auTokens[w]).address,k.underlying),x=u.minus(y).gt(0)?u.minus(y):new t(0),E=x.div(o[w].collateralRatio).div(l[w]),o[w].maxWithdrawableAmount=o[w].isCollateral&&E.lt(o[w].depositBalance.formattedAmount())?new ce(g.underlying,E.toFixed(24),!1):new ce(g.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=D(H.mark((function e(t){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ue(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=Ke(r.depositBalance,new t(r.underlyingPrice)).multipliedBy(r.collateralRatio).multipliedBy(L);i=o==exports.MarketAction.EnableCollateral?i.plus(s):i.minus(s);break;case exports.MarketAction.Deposit:case exports.MarketAction.Withdraw:s=Ke(a,new t(r.underlyingPrice)).multipliedBy(r.collateralRatio).multipliedBy(L),i=o==exports.MarketAction.Deposit?i.plus(s):i.minus(s);break;case exports.MarketAction.Borrow:case exports.MarketAction.Repay:var c=Ke(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=D(H.mark((function e(){var t,n,o,a;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new rt(this._networkConnection),n={contract:this.env.ply,method:"balanceOf",returnTypes:["uint256"]},e.next=4,t.aggregate([O({},n,{method:"totalSupply",args:[]}),O({},n,{args:[A.misc.TEAM_MULTISIG]}),O({},n,{args:[A.misc.COMPTROLLER]}),O({},n,{args:[A.misc.AURIFAIRLAUNCH]}),O({},n,{args:[A.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 ce(ue,a.toString()));case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),n}(M),ot=function(e){function n(t,n,o){var a;return(a=e.call(this,t)||this).env=new q(t),a.auToken=z(o,x)?new r.Contract(n,u.abi,t.provider):new r.Contract(n,i.abi,t.provider),a.underlying=new ie(o,X(o)),a}U(n,e);var o=n.prototype;return o.getRewardSpeeds=function(){var e=D(H.mark((function e(){return H.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=D(H.mark((function e(){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=ce,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=D(H.mark((function e(){var t,n,o,a=this;return H.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 ce(a.underlying,e.toString())}))),e.next=5,Promise.all(t);case 5:return e.abrupt("return",new ce(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=D(H.mark((function e(){return H.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=D(H.mark((function e(){return H.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=D(H.mark((function e(){return H.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=D(H.mark((function e(){var t,r,n,o,a;return H.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 ce(ue,e.toString())}))),t.push(Ue(A.tokens.PLY,this._networkConnection.provider).then((function(e){o=e}))),t.push(Ue(this.underlying.address,this._networkConnection.provider).then((function(e){a=e}))),e.next=7,Promise.all(t);case 7:return e.abrupt("return",ee(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=D(H.mark((function e(){var t,r,n,o,a;return H.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 ce(ue,e.toString())}))),t.push(Ue(A.tokens.PLY,this._networkConnection.provider).then((function(e){o=e}))),t.push(Ue(this.underlying.address,this._networkConnection.provider).then((function(e){a=e}))),e.next=7,Promise.all(t);case 7:return e.abrupt("return",ee(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=D(H.mark((function e(){var r,n,o,a,i,u,s,c,p,f,l,d,h,w;return H.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(Ue(A.tokens.PLY,this._networkConnection.provider).then((function(e){s=e}))),r.push(Ue(this.underlying.address,this._networkConnection.provider).then((function(e){c=e}))),e.next=11,Promise.all(r);case 11:return f=ee(Ke(new ce(ue,p.plyRewardBorrowSpeed.toString()),s),c.multipliedBy(o.formattedAmount()),31536e3),l=ee(Ke(new ce(ue,p.plyRewardSupplySpeed.toString()),s),c.multipliedBy(n.formattedAmount()),31536e3),e.t0=$e,e.next=16,He(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=$e,e.next=22,He(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=z(this.underlying.address,A.tokens.stNEAR)?ee(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 ce(ue,p.plyRewardSupplySpeed.mul(86400).mul(7).toString()),borrowPlyPerWeek:new ce(ue,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=D(H.mark((function e(t){return H.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 ce(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=D(H.mark((function e(t){return H.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 ce(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 ie(A.tokens.WNEAR,X(A.tokens.WNEAR)),t=J();if(t<=1651845600&&t>1650636e3){var r,n=null!=(r=T[this.underlying.address.toLocaleLowerCase()])?r:"0";return new ce(e,n,!1)}return new ce(e,"0")},o.getBorrowNEARRewardPerWeek=function(){var e=new ie(A.tokens.WNEAR,X(A.tokens.WNEAR)),t=J();if(t<=1651845600&&t>1650636e3){var r,n=null!=(r=S[this.underlying.address.toLocaleLowerCase()])?r:"0";return new ce(e,n,!1)}return new ce(e,"0")},n}(M),at=function(e){function n(t,n,o){var a;return(a=e.call(this,t,n,o)||this)._EthRepayHelper=new r.Contract(A.misc.ETHREPAYHELPER,d.abi,t.provider),a}U(n,e);var o=n.prototype;return o.deposit=function(){var e=D(H.mark((function e(t){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!z(t.token.address,x)){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=D(H.mark((function e(t){return H.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=D(H.mark((function e(r){return H.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(P));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=D(H.mark((function e(r){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!z(r.token.address,x)){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(P));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=D(H.mark((function e(){return H.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=D(H.mark((function e(){return H.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}(ot),it=function(e){function t(t,r){var n;return(n=e.call(this)||this).address=$(t),n.underlying=$(r),n}U(t,e);var r=t.prototype;return r.read=function(e){return new ot(e,this.address,this.underlying)},r.readWrite=function(e){return new at(e,this.address,this.underlying)},t}(Y),ut=r.BigNumber.from(1e4),st=function(e){function n(t){var r;(r=e.call(this,t)||this).env=new q(t);var n=A.tokens.PLY,o=A.tokens.PULP;return r.plyToken=new ie(n,X(n)),r.pulpToken=new ie(o,X(o)),r}U(n,e);var o=n.prototype;return o.getPlyBalance=function(){var e=D(H.mark((function e(t){return H.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 ce(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=D(H.mark((function e(t){return H.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 ce(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=D(H.mark((function e(t){return H.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,C,{from:t});case 2:return e.abrupt("return",new ce(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=D(H.mark((function e(n){var o,a,i,u,s,c,p,f,l,d,h,w,m;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=this.getWeek(J()),(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 ce(this.plyToken,l.toString()),currentPulp:new ce(this.pulpToken,f.toString()),nextUnlockPortion:new t(m).dividedBy(100).toNumber(),nextPly:new ce(this.plyToken,d.toString()),nextPulp:new ce(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=D(H.mark((function e(t,r){return H.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(J())+1)},o.getUnlockPortionAt=function(){var e=D(H.mark((function e(t,r){var n;return H.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}(M),ct=function(e){function t(t){return e.call(this,t)||this}U(t,e);var r=t.prototype;return r.redeem=function(){var e=D(H.mark((function e(t,r){return H.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=D(H.mark((function e(t){return H.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}U(t,e);var r=t.prototype;return r.read=function(e){return new st(e)},r.readWrite=function(e){return new ct(e)},t}(Y),ft=function(e){function t(t){var n;return(n=e.call(this,t)||this).referral=new r.Contract(A.misc.REFERRAL,y.abi,t.provider),n}U(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=D(H.mark((function e(t){return H.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=D(H.mark((function e(t){return H.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=D(H.mark((function e(t){var n;return H.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}(M),lt=function(e){function t(){return e.apply(this,arguments)||this}U(t,e);var n=t.prototype;return n.registerNewReferralCode=function(){var e=D(H.mark((function e(){var t;return H.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=D(H.mark((function e(t){var n;return H.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}(ft),dt=function(e){function t(){return e.call(this)||this}U(t,e);var r=t.prototype;return r.read=function(e){return new ft(e)},r.readWrite=function(e){return new lt(e)},t}(Y),ht=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new q(t),r}U(t,e);var n=t.prototype;return n.getPLYWNEARPoolDetails=function(){var e=D(H.mark((function e(){var t,r,n,o,a,i,u,s,c;return H.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 ce(se,t.toString()),e.next=5,He(n,this._networkConnection.provider);case 5:for(o=e.sent,a=[],i=0;i<r.length;i++)s=new ie(u=R[i],X(u)),a.push(He(new ce(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=ee(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=D(H.mark((function e(t){return H.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 ce(se,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=D(H.mark((function e(t){var n;return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new r.Contract(A.tokens.PLYWNEAR,h.abi,this._networkConnection.provider),e.next=3,n.balanceOf(t);case 3:return e.abrupt("return",new ce(se,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=D(H.mark((function e(t){return H.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 ce.fromAddressAndAmount(R[t],e.toString())})));case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(M),wt=function(e){function t(){return e.apply(this,arguments)||this}U(t,e);var n=t.prototype;return n.stake=function(){var e=D(H.mark((function e(t){return H.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=D(H.mark((function e(t){var n,o,a,i;return H.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}(ht),mt=function(e){function t(){return e.call(this)||this}U(t,e);var r=t.prototype;return r.read=function(e){return new ht(e)},r.readWrite=function(e){return new wt(e)},t}(Y),vt=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new q(t),r._stakingRead=new ht(t),r._misc=new nt(t),r}U(t,e);var r=t.prototype;return r.getUserDetails=function(){var e=D(H.mark((function e(t){return H.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=D(H.mark((function e(){return H.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=D(H.mark((function e(t){return H.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=D(H.mark((function e(t){return H.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=D(H.mark((function e(t){return H.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=D(H.mark((function e(t){return H.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=D(H.mark((function e(){return H.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)}}(),t}(M),yt=function(e){function t(){return e.apply(this,arguments)||this}U(t,e);var r=t.prototype;return r.claim=function(){var e=D(H.mark((function e(){return H.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=D(H.mark((function e(){return H.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=P,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=D(H.mark((function e(t){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new wt(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=D(H.mark((function e(t){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new wt(this._networkConnection).unstake(t));case 1: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}U(t,e);var r=t.prototype;return r.read=function(e){return new vt(e)},r.readWrite=function(e){return new yt(e)},t}(Y);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=C,exports.AURORA_CHAINID=1313161554,exports.Airdrop=tt,exports.AirdropRead=Xe,exports.AirdropReadWrite=et,exports.AuriEnv=q,exports.BORROW_LIMIT_BUFFER=L,exports.BORROW_NEAR_REWARDS_PER_WEEK=S,exports.BlockchainEntity=Y,exports.BlockchainEntityRead=M,exports.BlockchainEntityReadWrite=j,exports.DECIMAL_PRECISION=10,exports.DEPOSIT_NEAR_REWARDS_PER_WEEK=T,exports.ETHAddress=x,exports.HARDCODE_PRICE_TOKENS=B,exports.INF=P,exports.MiscRead=nt,exports.MoneyMarket=it,exports.MoneyMarketRead=ot,exports.MoneyMarketReadWrite=at,exports.ONE_DAY=86400,exports.ONE_WEEK=604800,exports.ONE_YEAR=31536e3,exports.PLYToken=ue,exports.PLYWNEARToken=se,exports.PLYWNEAR_POOL_ID=0,exports.PLYWNEAR_REWARD_TOKENS=R,exports.PRICE_WHITELISTED=E,exports.Papermill=pt,exports.PapermillRead=st,exports.PapermillReadWrite=ct,exports.REWARD_CLAIM_START=1651759200,exports.Referral=dt,exports.ReferralRead=ft,exports.ReferralReadWrite=lt,exports.SDK=bt,exports.SdkRead=vt,exports.SdkReadWrite=yt,exports.Staking=mt,exports.StakingRead=ht,exports.StakingReadWrite=wt,exports.Token=ie,exports.TokenAmount=ce,exports.TransferEventQuery=Je,exports.assert=V,exports.calcLMRewardApr=ee,exports.calcValuation=Ke,exports.decimalFactor=Z,exports.decimalRecords=_,exports.devLog=ae,exports.dummyAddress="0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE",exports.dummyMarketAddress="0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f",exports.dummyPly=fe,exports.dummyPlyAurora=le,exports.dummyToken=pe,exports.dummyTokenAmount=de,exports.dummyTokenAmount2=we,exports.dummyTokenAmount3=me,exports.dummyUserMarketDetails=ve,exports.dummyZeroTokenAmount=he,exports.fetchLPPositions=xe,exports.fetchLPPrice=Ee,exports.fetchPLYPrice=Fe,exports.fetchPULPPrice=Me,exports.fetchPrice=Ue,exports.fetchPriceFromCoingecko=ke,exports.fetchPriceFromCoingeckoAPI=ye,exports.fetchPriceFromOracle=Ce,exports.fetchStNEARPrice=Be,exports.fetchToken0PriceByLP=Ye,exports.fetchUnderlyingTokensPrices=Te,exports.fetchValuation=He,exports.formatObject=Q,exports.getBlockBeforeTimestamp=ne,exports.getBlockTimestamp=te,exports.getCurrentTimestamp=J,exports.getDecimal=X,exports.getQuery=G,exports.isSameAddress=z,exports.networkAddresses=A,exports.validateAndParseAddress=$,exports.valuateToken=Ve;
2
2
  //# sourceMappingURL=sdk.cjs.production.min.js.map