@aurigami/sdk 1.18.2 → 1.18.4

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"),a=e(require("@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json")),o=e(require("@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json")),i=e(require("@aurigami/contracts/artifacts/contracts/AuriAirdrop.sol/AuriAirdrop.json")),s=e(require("@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json")),u=e(require("@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json")),c=e(require("@aurigami/contracts/artifacts/contracts/AuriOracle.sol/AuriOracle.json")),p=e(require("@aurigami/contracts/artifacts/contracts/AuToken.sol/AuToken.json")),l=e(require("@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json")),f=e(require("@aurigami/contracts/artifacts/contracts/EthRepayHelper.sol/EthRepayHelper.json")),d=e(require("@aurigami/contracts/artifacts/contracts/interfaces/EIP20Interface.sol/EIP20Interface.json")),h=e(require("@aurigami/contracts/artifacts/contracts/mock/AuriInternalLens.sol/AuriInternalLens.json")),m=e(require("@aurigami/contracts/artifacts/contracts/mock/IUniswapV2Pair.sol/IUniswapV2Pair.json")),w=e(require("@aurigami/contracts/artifacts/contracts/mock/Multicall2.sol/Multicall2.json")),y=e(require("@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json")),v=e(require("@aurigami/contracts/artifacts/contracts/ReferralDirectoryV2.sol/ReferralDirectoryV2.json")),g=e(require("@aurigami/contracts/artifacts/contracts/plygame/PlyGame.sol/PlyGame.json")),b=e(require("@aurigami/contracts/artifacts/contracts/PlyTokenLock.sol/PlyTokenLock.json")),k=e(require("@aurigami/contracts/deployments/aurora_mainnet.json")),x=e(require("@aurigami/contracts/deployments/aurora_testnet.json")),A=e(require("axios")),P=require("@ethersproject/abstract-signer"),_=require("tslib"),L=require("cache-decorator"),R={__proto__:null,AuriOracleABI:c,AuTokenABI:p,IUniswapV2PairABI:m,AuriAirdropABI:i,AuriFairLaunchABI:s,AuriLensABI:u,ComptrollerABI:l,EIP20InterfaceABI:d,ReferralDirectoryV2ABI:v,AuErc20ABI:a,AuETHABI:o,EthRepayHelperABI:f,Multicall2ABI:w,PulpABI:y,AuriInternalLensABI:h,PlyGameABI:g,PlyTokenLockABI:b},T="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",E={auTokens:[{name:"auUSDC",address:k.auTokens.USDC.toLowerCase(),underlying:"0xb12bfca5a55806aaf64e99521918a4bf0fc40802".toLowerCase()},{name:"auETH",address:k.auTokens.ETH.toLowerCase(),underlying:T.toLowerCase()},{name:"auWBTC",address:k.auTokens.WBTC.toLowerCase(),underlying:"0xf4eb217ba2454613b15dbdea6e5f22276410e89e".toLowerCase()},{name:"auUSDT",address:k.auTokens.USDT.toLowerCase(),underlying:"0x4988a896b1227218e4a686fde5eabdcabd91571f".toLowerCase()},{name:"auDAI",address:k.auTokens.DAI.toLowerCase(),underlying:"0xe3520349f477a5f6eb06107066048508498a291b".toLowerCase()},{name:"auWNEAR",address:k.auTokens.WNEAR.toLowerCase(),underlying:"0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d".toLowerCase()},{name:"auSTNEAR",address:k.auTokens.STNEAR.toLowerCase(),underlying:"0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30".toLowerCase()},{name:"auAURORA",address:k.auTokens.AURORA.toLowerCase(),underlying:"0x8bec47865ade3b172a928df8f990bc7f2a3b9f79".toLowerCase()},{name:"auTRI",address:k.auTokens.TRI.toLowerCase(),underlying:"0xFa94348467f64D5A457F75F8bc40495D33c65aBB".toLowerCase()},{name:"auPLY",address:k.auTokens.PLY.toLowerCase(),underlying:"0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f".toLowerCase()},{name:"auUSN",address:k.auTokens.USN.toLowerCase(),underlying:"0x5183e1b1091804bc2602586919e6880ac1cf2896".toLowerCase()},{name:"auNEARX",address:k.auTokens.NEARX.toLowerCase(),underlying:"0xb39eeb9e168ef6c639f5e282fef1f6bc4dcae375".toLowerCase()}],misc:{COMPTROLLER:k.comptroller.toLowerCase(),oracle:k.oracle.toLowerCase(),AURIFAIRLAUNCH:k.fairLaunch.toLowerCase(),AURILENS:k.auriLens.toLowerCase(),ETHREPAYHELPER:k.ethRepayHelper.toLowerCase(),AURI_AIRDROP:k.auriAirdrop.toLowerCase(),MULTICALL:k.multicall.toLowerCase(),TEAM_MULTISIG:"0x2D05FfFE70CE64c5954710D4C308dB31C8dBd8dE".toLowerCase(),TEAM_MULTISIG_AURORA_PLUS:"0x31f501589c7a090bf68f2fe2687744bf9130e1ab".toLowerCase(),AURORA_PLUS:"0xf075c896cbbb625e7911e284cd23ee19bdccf299".toLowerCase(),PULP_CONTRACT:"0x04ac48711bcdc45b4d223fb021e09da73c71095e".toLowerCase(),PLY_TOKEN_LOCK:k.plyTokenLock.toLowerCase(),REFERRAL:k.referralDirectory.toLowerCase(),REFERRAL_V2:"0xCECd147409B2d64A9A2E5418e3E471E8af19E0bd".toLowerCase(),AURI_INTERNAL_LENS:k.auriInternalLens.toLowerCase(),PLYGAME:k.plyGame.toLowerCase()},tokens:{AURORA:"0x8bec47865ade3b172a928df8f990bc7f2a3b9f79".toLowerCase(),PLY:"0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f".toLowerCase(),stNEAR:"0x07f9f7f963c5cd2bbffd30ccfb964be114332e30".toLowerCase(),USDC:"0xb12bfca5a55806aaf64e99521918a4bf0fc40802".toLowerCase(),WNEAR:"0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d".toLowerCase(),TRI:"0xFa94348467f64D5A457F75F8bc40495D33c65aBB".toLowerCase(),META:"0xc21ff01229e982d7c8b8691163b0a3cb8f357453".toLowerCase(),PULP:k.PULP.toLowerCase(),PLYWNEAR:k.ply_wnear_lp.toLowerCase(),USN:"0x5183e1b1091804bc2602586919e6880ac1cf2896".toLowerCase(),PLY_WNEAR:"0x044b6b0cd3bb13d2b9057781df4459c66781dce7".toLowerCase(),WNEAR_TRI:"0x84b123875f0f36b966d0b6ca14b31121bd9676ad".toLowerCase(),AURORA_WNEAR:"0x1e0e812fbcd3eb75d8562ad6f310ed94d258d008".toLowerCase(),NEARX:"0xb39eeb9e168ef6c639f5e282fef1f6bc4dcae375".toLowerCase(),STADER:"0x078e103d5f9629ac48b8563fa2bfcd2f6d5fde84".toLowerCase()}},C=[k.auTokens.AURORA.toLowerCase(),k.auTokens.TRI.toLowerCase(),k.auTokens.PLY.toLowerCase(),k.auTokens.USN.toLowerCase()],B=new Set([].concat(E.auTokens.map((function(e){return e.underlying})),[E.tokens.AURORA,E.tokens.TRI,E.tokens.META,E.tokens.stNEAR,E.tokens.STADER])),S=new t(1),N=["0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f","0x04Ac48711BCdc45b4d223fb021E09DA73c71095e","0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d","0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30","0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79","0xFa94348467f64D5A457F75F8bc40495D33c65aBB"],D=[0],U=r.BigNumber.from(2).pow(256).sub(1),I=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]}))),O={},M=Object.fromEntries([[E.tokens.USN.toLowerCase(),"1"]]),F=Object.fromEntries([["referral-2505",{start:1652882400,end:1653487199}],["referrer-2505",{start:1652882400,end:1653487199}],["referral-0106",{start:1653487200,end:1654091999}],["referrer-0106",{start:1653487200,end:1654091999}],["referral-0806",{start:1654092e3,end:1654696799}],["referrer-0806",{start:1654092e3,end:1654696799}],["referral-1506",{start:1654696800,end:1655301599}],["referrer-1506",{start:1654696800,end:1655301599}]]),W={"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,"0x84b123875f0f36b966d0b6ca14b31121bd9676ad":18,"0x1e0e812fbcd3eb75d8562ad6f310ed94d258d008":18,"0xb39eeb9e168ef6c639f5e282fef1f6bc4dcae375":24,"0x078e103d5f9629ac48b8563fa2bfcd2f6d5fde84":18};function Y(){Y=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",s=a.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 c(e,t,r,a){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),i=new _(a||[]);return n(o,"_invoke",{value:k(e,r,i)}),o}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l={};function f(){}function d(){}function h(){}var m={};u(m,o,(function(){return this}));var w=Object.getPrototypeOf,y=w&&w(w(L([])));y&&y!==t&&r.call(y,o)&&(m=y);var v=h.prototype=f.prototype=Object.create(m);function g(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var a;n(this,"_invoke",{value:function(n,o){function i(){return new t((function(a,i){!function n(a,o,i,s){var u=p(e[a],e,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,i,s)}),(function(e){n("throw",e,i,s)})):t.resolve(l).then((function(e){c.value=e,i(c)}),(function(e){return n("throw",e,i,s)}))}s(u.arg)}(n,o,a,i)}))}return a=a?a.then(i,i):i()}})}function k(e,t,r){var n="suspendedStart";return function(a,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw o;return{value:void 0,done:!0}}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var s=x(i,r);if(s){if(s===l)continue;return s}}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 u=p(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function x(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),l;var a=p(n,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,l;var o=a.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,l):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function A(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 P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function L(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:R}}function R(){return{value:void 0,done:!0}}return d.prototype=h,n(v,"constructor",{value:h,configurable:!0}),n(h,"constructor",{value:d,configurable:!0}),d.displayName=u(h,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,u(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},g(b.prototype),u(b.prototype,i,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,a,o){void 0===o&&(o=Promise);var i=new b(c(t,r,n,a),o);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},g(v),u(v,s,"Generator"),u(v,o,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=L,_.prototype={constructor:_,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(P),!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 a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):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),l},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),P(r),l}},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 a=n.arg;P(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:L(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function j(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function H(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){j(o,n,a,i,s,"next",e)}function s(e){j(o,n,a,i,s,"throw",e)}i(void 0)}))}}function q(){return(q=Object.assign?Object.assign.bind():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 V(e,t){var r,n;e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r=e,n=t,(Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(r,n)}function G(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 K(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 G(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)?G(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 Z=Object.fromEntries(E.auTokens.map((function(e){return[e.address,e.name]})).concat(E.auTokens.map((function(e){return[e.underlying,e.name.slice(2)]}))).concat([["0x04ac48711bcdc45b4d223fb021e09da73c71095e","PULP"]]).map((function(e){var t=e[1];return[e[0].toLowerCase(),t]})));function Q(e,t,r){return X.apply(this,arguments)}function X(){return(X=H(Y().mark((function e(t,r,n){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n&&(n={}),n=q({},n,{module:t,action:r}),e.next=4,A.get("https://explorer.mainnet.aurora.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)}var z="https://explorer.mainnet.aurora.dev/graphiql";function J(e){return $.apply(this,arguments)}function $(){return($=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,A.post(z,{query:t});case 2:return e.abrupt("return",e.sent.data.data);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ee(e,t){if(void 0===t&&(t=""),!e)throw t="Assertion failed"+(t?": "+t:""),new Error(t)}function te(e){return JSON.stringify(e,null," ")}function re(e){return r.BigNumber.from(10).pow(e).toString()}var ne=function(e,t){return e.toLowerCase()==t.toLowerCase()},ae=function(){return Math.trunc(Date.now()/1e3)};function oe(e){return ie.apply(this,arguments)}function ie(){return(ie=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){setTimeout(e,t)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function se(e){try{return r.utils.getAddress(e)}catch(t){throw new Error("Invalid address: "+e)}}function ue(e){var t=e.toLowerCase();return ee(null!=W[t],"Decimal not found for "+e),W[t]}function ce(e){var t=e.toLowerCase();return ee(null!=Z[t],"Symbol not found for "+e),Z[t]}function pe(e){var t=e.toLowerCase(),r=E.auTokens.filter((function(e){return e.address==t}));if(0==r.length)throw new Error("Underlying not found for "+e);return r[0].underlying}function le(e,r,n){return e.isZero()?new t(0):r.lte(0)?e:e.multipliedBy(n).dividedBy(r)}function fe(e,t,r,n){return e.multipliedBy(t).minus(r.multipliedBy(n))}function de(e,t){return he.apply(this,arguments)}function he(){return(he=H(Y().mark((function e(t,r){return Y().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 me(e,t){return we.apply(this,arguments)}function we(){return(we=H(Y().mark((function e(t,r){var n,a,o,i,s;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=200,a=[],o=0;case 3:if(!(o<r.length)){e.next=14;break}return i=r.slice(o,o+n),s=i.map(function(){var e=H(Y().mark((function e(r){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",de(t,r));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.t0=a,e.next=9,Promise.all(s);case 9:e.t1=e.sent,a=e.t0.concat.call(e.t0,e.t1);case 11:o+=n,e.next=3;break;case 14:return e.abrupt("return",a);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ye(e,t){return ve.apply(this,arguments)}function ve(){return(ve=H(Y().mark((function e(t,r){var n,a,o,i,s,u;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!=r.length){e.next=2;break}return e.abrupt("return",[]);case 2:for(n=[],a=r.map((function(e){return"b"+e+": block(number: "+e+") { timestamp }"})),o=0;o<a.length;o+=100)i="{ "+a.slice(o,o+100).join("\n")+" }",n.push(J(i));return e.next=8,Promise.all(n);case 8:return s=e.sent.reduce((function(e,t){return q({},e,t)})),(u=r.filter((function(e){return!s["b"+e]}))).length>0&&u.join(", "),e.next=13,me(t,u);case 13:return e.sent.forEach((function(e,t){s["b"+u[t]]={timestamp:new Date(1e3*e).toISOString()}})),e.abrupt("return",r.map((function(e){return Math.trunc(new Date(s["b"+e].timestamp).getTime()/1e3)})));case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ge(e,t){return be.apply(this,arguments)}function be(){return(be=H(Y().mark((function e(t,r){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Q("block","getblocknobytime",{timestamp:r,closest:"before"});case 2:if(e.t0=parseInt(e.sent.blockNumber),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 ke(e){}function xe(e){return e.sort((function(e,t){return e.blockNumber==t.blockNumber?e.logIndex-t.logIndex:e.blockNumber-t.blockNumber}))}var Ae=function(e){this._networkConnection=e},Pe=function(e){function t(t){if(!(t.signer instanceof P.Signer))throw Error("Signer is not provided when constructing BlockchainEntityReadWrite");return e.call(this,t)||this}return V(t,e),t}(Ae),_e=function(){function e(){}var t=e.prototype;return t.read=function(e){return new Ae(e)},t.readWrite=function(e){return new Pe(e)},e}(),Le=function(e){function t(){var t;return(t=e.apply(this,arguments)||this)._comptroller=null,t._auriFairLaunch=null,t._auriLens=null,t._ply=null,t._pulp=null,t._auriInternalLens=null,t._auriAirdrop=null,t._referralDirectoryV2=null,t._oracle=null,t._plygame=null,t._plyTokenLock=null,t}V(t,e);var n,o,f=t.prototype;return f.getContract=function(e,t){return new r.Contract(e,t,this._networkConnection.provider)},f.getAuTokenContracts=function(){var e=this;return E.auTokens.map((function(t){var r=e.getContract(t.address,p.abi);return r.underlying=t.underlying,r}))},f.getAuErc20Contract=function(e){var t,r=e.address,n=e.underlyingName;return ee(void 0!==r||void 0!==n,"Either address or underlyingName must be provided"),n&&ee(void 0!==(r=null==(t=E.auTokens.find((function(e){return e.name=="au"+n})))?void 0:t.address),"AuToken with underlying "+n+" not found"),this.getContract(r,a.abi)},n=t,(o=[{key:"comptroller",get:function(){return this._comptroller||(this._comptroller=this.getContract(E.misc.COMPTROLLER,l.abi)),this._comptroller}},{key:"auriFairLaunch",get:function(){return this._auriFairLaunch||(this._auriFairLaunch=this.getContract(E.misc.AURIFAIRLAUNCH,s.abi)),this._auriFairLaunch}},{key:"auriLens",get:function(){return this._auriLens||(this._auriLens=this.getContract(E.misc.AURILENS,u.abi)),this._auriLens}},{key:"ply",get:function(){return this._ply||(this._ply=this.getContract(E.tokens.PLY,d.abi)),this._ply}},{key:"pulp",get:function(){return this._pulp||(this._pulp=this.getContract(E.tokens.PULP,y.abi)),this._pulp}},{key:"auriInternalLens",get:function(){return this._auriInternalLens||(this._auriInternalLens=this.getContract(E.misc.AURI_INTERNAL_LENS,h.abi)),this._auriInternalLens}},{key:"auriAirdrop",get:function(){return this._auriAirdrop||(this._auriAirdrop=this.getContract(E.misc.AURI_AIRDROP,i.abi)),this._auriAirdrop}},{key:"referralDirectoryV2",get:function(){return this._referralDirectoryV2||(this._referralDirectoryV2=this.getContract(E.misc.REFERRAL_V2,v.abi)),this._referralDirectoryV2}},{key:"oracle",get:function(){return this._oracle||(this._oracle=this.getContract(E.misc.oracle,c.abi)),this._oracle}},{key:"plygame",get:function(){return this._plygame||(this._plygame=this.getContract(E.misc.PLYGAME,g.abi)),this._plygame}},{key:"plyTokenLock",get:function(){return this._plyTokenLock||(this._plyTokenLock=this.getContract(E.misc.PLY_TOKEN_LOCK,b.abi)),this._plyTokenLock}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,"symbol"==typeof(a=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(n.key))?a:String(a),n)}var a}(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),t}(Ae),Re=function(e,t){this.address=e.toLowerCase(),this.decimals=t},Te=new Re(E.tokens.PLY,ue(E.tokens.PLY)),Ee=new Re(E.tokens.PLYWNEAR,ue(E.tokens.PLYWNEAR)),Ce=function(){function e(e,r,n){void 0===n&&(n=!0),this.rawAmnt=n?r:new t(r).times(re(e.decimals)).toFixed(0),this.token=e}var r=e.prototype;return r.formattedAmount=function(e,r){return void 0!==e&&void 0!==r?new t(this.rawAmnt).div(re(this.token.decimals)).toFormat(e,r):new t(this.rawAmnt).div(re(this.token.decimals)).toString()},r.formattedAmountWithSymbol=function(e,t){return this.formattedAmount(e,t)+" "+ce(this.token.address)},r.rawAmount=function(){return this.rawAmnt},r.compare=function(e){return new t(this.rawAmnt).comparedTo(new t(e.rawAmnt))},e.fromAddressAndAmount=function(t,r,n){return void 0===n&&(n=!0),new e(new Re(t,ue(t)),r,n)},e}(),Be=new Re(E.tokens.WNEAR,24),Se=new Re("0x8729438eb15e2c8b576fcc6aecda6a148776c0f5",18),Ne=new Re("0xE530dC2095Ef5653205CF5ea79F8979a7028065c",18),De=new Ce(Be,"123.456",!1),Ue=new Ce(Be,"0"),Ie=new Ce(Be,"456.123",!1),Oe=new Ce(Be,"1000.123",!1),Me={market:"0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f",depositBalance:Ie,borrowBalance:Ue,isCollateral:!0,maxWithdrawableAmount:De,collateralRatio:.5,underlyingPrice:"1"},Fe={campaign:"testa",startTime:Math.trunc(new Date(2022,8,1).getTime()/1e3),endTime:Math.trunc(new Date(2022,9,30).getTime()/1e3),isReferrer:!1,rewardTokenAmount:De,transactionHash:null,userAddr:"0x...123",refereeAddress:"0x123..123"},We={campaign:"testb",startTime:Math.trunc(new Date(2022,8,1).getTime()/1e3),endTime:Math.trunc(new Date(2022,8,31).getTime()/1e3),isReferrer:!0,rewardTokenAmount:Ie,transactionHash:"0x4da9657663b46ef18d150b897b28c7b717f16421978b52e3a06d91b54ca3548b",userAddr:"0x...456",refereeAddress:"0x123..123"};function Ye(e,t){return je.apply(this,arguments)}function je(){return(je=H(Y().mark((function e(t,r){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===r&&(r={}),e.next=3,A.get("https://api.aurigami.finance/app/"+t+"?"+new URLSearchParams(r),{headers:{"Content-Type":"application/json"}});case 3:return e.abrupt("return",e.sent.data);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function He(e,t,r,n){return qe.apply(this,arguments)}function qe(){return(qe=H(Y().mark((function e(t,r,n,a){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===r&&(r={}),void 0===n&&(n=1),void 0===a&&(a=50),r=q({},r,{page:n,limit:a}),e.next=6,A.get("https://api.aurigami.finance/app/"+t+"?"+new URLSearchParams(r),{headers:{"Content-Type":"application/json"}});case 6:return e.abrupt("return",e.sent.data);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ve(e){return Ge.apply(this,arguments)}function Ge(){return(Ge=H(Y().mark((function e(r){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,A.post("https://coins.llama.fi/prices",{coins:[r]}).then((function(e){return e.data.coins[r].price})).catch((function(e){return console.log("unable to fetch price from DefiLlama API: "+e),console.error(e),0}));case 2:return e.abrupt("return",new t(e.sent));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ke(e){return Ze.apply(this,arguments)}function Ze(){return(Ze=H(Y().mark((function e(r){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,A.get("https://api.coingecko.com/api/v3/simple/price?ids="+r+"&vs_currencies=usd").then((function(e){return e.data[r]})).catch((function(e){return console.log("Unable to fetch price from Coingecko API for "+r),console.error(e),{usd:0}}));case 2:return e.abrupt("return",new t(e.sent.usd));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Qe(e){return Xe.apply(this,arguments)}function Xe(){return(Xe=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.toLowerCase()!=E.tokens.AURORA&&t.toLowerCase()!=E.tokens.TRI&&t.toLowerCase()!=E.tokens.META){e.next=2;break}return e.abrupt("return",Ve("aurora:"+t.toLowerCase()));case 2:throw Error("Unknown token "+t+" in fetchPriceFromDefiLlama");case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ze(e){return Je.apply(this,arguments)}function Je(){return(Je=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t.toLowerCase(),e.next=e.t0===E.tokens.AURORA?3:e.t0===E.tokens.TRI?4:e.t0===E.tokens.META?5:e.t0===E.tokens.STADER?6:7;break;case 3:return e.abrupt("return",Ke("aurora-near"));case 4:return e.abrupt("return",Ke("trisolaris"));case 5:return e.abrupt("return",Ke("meta-pool"));case 6:return e.abrupt("return",Ke("stader"));case 7:throw Error("Unknown token "+t+" in fetchPriceFromCoingecko");case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $e(e,t){return et.apply(this,arguments)}function et(){return(et=H(Y().mark((function e(t,n){var a,o,i;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=new r.Contract(t,m.abi,n),e.next=3,Promise.all([a.token0(),a.token1(),a.getReserves(),a.totalSupply()]);case 3:return e.abrupt("return",{token0:(o=e.sent)[0],token1:o[1],reserve0:(i=o[2]).reserve0,reserve1:i.reserve1,totalSupply:o[3]});case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tt(e,t){return rt.apply(this,arguments)}function rt(){return(rt=H(Y().mark((function e(r,n){var a,o,i,s,u;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=function(){return(s=H(Y().mark((function e(r){var i,s,u;return Y().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,lt(r.address,n);case 4:return i=e.sent,s=ue(r.address),u=i.multipliedBy(r.reserve.toString()).multipliedBy(2),e.abrupt("return",u.multipliedBy(re(o)).dividedBy(new t(a.totalSupply.toString())).dividedBy(re(s)));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)},i=function(e){return s.apply(this,arguments)},e.next=4,$e(r,n);case 4:return a=e.sent,o=ue(r),e.prev=6,e.next=9,i({address:a.token0,reserve:a.reserve0});case 9:if(!(u=e.sent).isZero()){e.next=12;break}throw Error("Price is zero");case 12:return e.abrupt("return",u);case 15:return e.prev=15,e.t0=e.catch(6),e.prev=18,e.next=21,i({address:a.token1,reserve:a.reserve1});case 21:return e.abrupt("return",e.sent);case 24:throw e.prev=24,e.t1=e.catch(18),Error("Unable to fetch price for both tokens of LP "+r);case 28:case"end":return e.stop()}}),e,null,[[6,15],[18,24]])})))).apply(this,arguments)}function nt(){return at.apply(this,arguments)}function at(){return(at=H(Y().mark((function e(){var r,n,a,o,i;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=A.get("https://validators.narwallets.com/metrics_json").then((function(e){return e.data})),n=Ke("near"),e.next=4,Promise.all([r,n]);case 4:return o=(a=e.sent)[1],i=new t(a[0].st_near_price),e.abrupt("return",i.multipliedBy(o));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ot(e,r){return new t(e.toString()).div(re(36-r))}function it(e,t,r){return st.apply(this,arguments)}function st(){return(st=H(Y().mark((function e(t,n,a){var o,i,s;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=new r.Contract(E.misc.oracle,c.abi,a),e.next=3,o.getUnderlyingPrice(t).catch((function(e){return console.log("Unable to fetch price from oracle for "+t),r.BigNumber.from(0)}));case 3:if(!(i=e.sent).isZero()){e.next=8;break}if("auSTNEAR"!=(null==(s=E.auTokens.find((function(e){return ne(e.address,t)})))?void 0:s.name)){e.next=8;break}return e.abrupt("return",nt());case 8:return e.abrupt("return",ot(i,n));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ut(e){return ct.apply(this,arguments)}function ct(){return(ct=H(Y().mark((function e(t){var n,a,o;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new r.Contract(E.misc.AURILENS,u.abi,t),a=E.auTokens.map((function(e){return e.address})),o=E.auTokens.map((function(e){return ue(e.underlying)})),e.next=5,n.auTokenUnderlyingPriceAll(a);case 5:return e.abrupt("return",e.sent.map((function(e,t){return{auToken:e.auToken,underlyingPrice:ot(e.underlyingPrice,o[t])}})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pt(e){return(e=e.toLowerCase())==E.tokens.AURORA||e==E.tokens.TRI||e==E.tokens.META||e==E.tokens.STADER}function lt(e,t){return ft.apply(this,arguments)}function ft(){return(ft=H(Y().mark((function e(t,r){var n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ee(B.has(t.toLocaleLowerCase()),"Address "+t+" is not whitelisted for price fetching"),!pt(t)){e.next=11;break}return e.prev=2,e.next=5,ze(t);case 5:return e.abrupt("return",e.sent);case 8:return e.prev=8,e.t0=e.catch(2),e.abrupt("return",Qe(t));case 11:if(void 0===(n=E.auTokens.find((function(e){return ne(e.underlying,t)})))){e.next=16;break}return e.abrupt("return",it(n.address,ue(t),r));case 16:throw Error("Unable to fetch price for "+t);case 17:case"end":return e.stop()}}),e,null,[[2,8]])})))).apply(this,arguments)}function dt(e,t){return ht.apply(this,arguments)}function ht(){return(ht=H(Y().mark((function e(r,n){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.toLowerCase()in M)){e.next=4;break}return e.abrupt("return",new t(M[r.toLowerCase()]));case 4:if(!ne(r,E.tokens.PLYWNEAR)){e.next=8;break}return e.abrupt("return",tt(r,n));case 8:if(!ne(r,E.tokens.PLY)){e.next=12;break}return e.abrupt("return",mt(n));case 12:if(!ne(r,E.tokens.PULP)){e.next=14;break}return e.abrupt("return",yt(n));case 14:return e.abrupt("return",lt(r,n));case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mt(e){return wt.apply(this,arguments)}function wt(){return(wt=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gt(E.tokens.PLYWNEAR,t));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function yt(e){return vt.apply(this,arguments)}function vt(){return(vt=H(Y().mark((function e(r){return Y().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 gt(e,t){return bt.apply(this,arguments)}function bt(){return(bt=H(Y().mark((function e(r,n){var a,o,i;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,$e(r,n);case 2:if(!(a=e.sent).reserve1.isZero()){e.next=5;break}return e.abrupt("return",new t(0));case 5:return o=ue(a.token0),i=ue(a.token1),e.next=9,dt(a.token1,n);case 9:return e.abrupt("return",e.sent.multipliedBy(a.reserve1.toString()).multipliedBy(re(o)).dividedBy(re(i)).dividedBy(a.reserve0.toString()));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kt(e,t){return xt.apply(this,arguments)}function xt(){return(xt=H(Y().mark((function e(r,n){return Y().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,dt(r.token.address,n);case 4:return e.abrupt("return",At(r,e.sent));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function At(e,r){return new t(e.formattedAmount()).multipliedBy(r)}function Pt(e,t){return _t.apply(this,arguments)}function _t(){return(_t=H(Y().mark((function e(t,r){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,kt(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 Lt=function(e){function t(t,n){var a;return(a=e.call(this,n)||this).auToken=new r.Contract(t,p.abi,a._networkConnection.provider),a}V(t,e);var n=t.prototype;return n.queryERC20TransfersOf=function(){var e=H(Y().mark((function e(t,r,n){var a,o,i,s=this;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=[this.auToken.filters.Transfer(t,null),this.auToken.filters.Transfer(null,t)],e.next=3,Promise.all(a.map((function(e){return s.auToken.queryFilter(e,r,n)})));case 3:return o=e.sent.flat(),(i=o.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=H(Y().mark((function e(t,r){return Y().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}(Ae);function Rt(e,t,r){return Tt.apply(this,arguments)}function Tt(){return(Tt=H(Y().mark((function e(t,n,a){var o,i,s;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=new r.Contract(t,m.abi,n),(i=[]).push(o.token0()),i.push(o.token1()),i.push(o.getReserves({blockTag:a})),i.push(o.totalSupply({blockTag:a})),e.next=8,Promise.all(i);case 8:return e.abrupt("return",{token0:(s=e.sent)[0],token1:s[1],reserve0:s[2].reserve0,reserve1:s[2].reserve1,totalSupply:s[3]});case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Et(e,t,r){return Ct.apply(this,arguments)}function Ct(){return(Ct=H(Y().mark((function e(r,n,a){var o,i,s,u,c;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=function(){return(u=H(Y().mark((function e(r,a){var s,u,c;return Y().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,Dt(r.address,n,a);case 4:return s=e.sent,u=ue(r.address),c=s.multipliedBy(r.reserve.toString()).multipliedBy(2),e.abrupt("return",c.multipliedBy(re(i)).dividedBy(new t(o.totalSupply.toString())).dividedBy(re(u)));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)},s=function(e,t){return u.apply(this,arguments)},e.next=4,Rt(r,n,a);case 4:return o=e.sent,i=ue(r),e.prev=6,e.next=9,s({address:o.token0,reserve:o.reserve0},a);case 9:if(!(c=e.sent).isZero()){e.next=12;break}throw Error("Price is zero");case 12:return e.abrupt("return",c);case 15:return e.prev=15,e.t0=e.catch(6),e.prev=18,e.next=21,s({address:o.token1,reserve:o.reserve1},a);case 21:return e.abrupt("return",e.sent);case 24:throw e.prev=24,e.t1=e.catch(18),Error("Unable to fetch price for both tokens of LP "+r);case 28:case"end":return e.stop()}}),e,null,[[6,15],[18,24]])})))).apply(this,arguments)}function Bt(e,r){return new t(e.toString()).div(re(36-r))}function St(e,t,r,n){return Nt.apply(this,arguments)}function Nt(){return(Nt=H(Y().mark((function e(t,n,a,o){var i;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=new r.Contract(E.misc.oracle,c.abi,a),e.next=3,i.getUnderlyingPrice(t,{blockTag:o}).catch((function(e){return console.log("Unable to fetch price from oracle for "+t),r.BigNumber.from(0)}));case 3:return e.abrupt("return",Bt(e.sent,n));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Dt(e,t,r){return Ut.apply(this,arguments)}function Ut(){return(Ut=H(Y().mark((function e(r,n,a){var o;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.toLowerCase()in M)){e.next=4;break}return e.abrupt("return",new t(M[r.toLowerCase()]));case 4:if(!(ne(r,E.tokens.PLY_WNEAR)||ne(r,E.tokens.WNEAR_TRI)||ne(r,E.tokens.AURORA_WNEAR))){e.next=8;break}return e.abrupt("return",Et(r,n,a));case 8:if(!ne(r,E.tokens.PLY)){e.next=12;break}return e.abrupt("return",Mt(E.tokens.PLY_WNEAR,n,a));case 12:if(!ne(r,E.tokens.TRI)){e.next=16;break}return e.abrupt("return",Mt(E.tokens.WNEAR_TRI,n,a,1));case 16:if(!ne(r,E.tokens.AURORA)){e.next=18;break}return e.abrupt("return",Mt(E.tokens.AURORA_WNEAR,n,a));case 18:if(void 0===(o=E.auTokens.find((function(e){return ne(e.underlying,r)})))){e.next=23;break}return e.abrupt("return",St(o.address,ue(r),n,a));case 23:throw Error("Unable to fetch price for "+r);case 24:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function It(e){return Ot.apply(this,arguments)}function Ot(){return(Ot=H(Y().mark((function e(r){return Y().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 Mt(e,t,r,n){return Ft.apply(this,arguments)}function Ft(){return(Ft=H(Y().mark((function e(r,n,a,o){var i,s,u;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===o&&(o=0),e.next=3,Rt(r,n,a);case 3:if(i=e.sent,1===o&&(i={token0:i.token1,token1:i.token0,reserve0:i.reserve1,reserve1:i.reserve0,totalSupply:i.totalSupply}),!i.reserve1.isZero()){e.next=7;break}return e.abrupt("return",new t(0));case 7:return s=ue(i.token0),u=ue(i.token1),e.next=11,Dt(i.token1,n,a);case 11:return e.abrupt("return",e.sent.multipliedBy(i.reserve1.toString()).multipliedBy(re(s)).dividedBy(re(u)).dividedBy(i.reserve0.toString()));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Wt={__proto__:null,getApi:Ye,getPaginatedApi:He,getQuery:Q,queryGraphQL:J,assert:ee,formatObject:te,decimalFactor:re,isSameAddress:ne,getCurrentTimestamp:ae,sleep:oe,validateAndParseAddress:se,getDecimal:ue,getSymbol:ce,getUnderlying:pe,calcLMRewardApr:le,calcNetApy:fe,getBlockTimestamp:de,getBlocksTimestampViaRPC:me,getBlocksTimestamp:ye,getBlockBeforeTimestamp:ge,devLog:ke,sortEvents:xe,fetchPriceFromDefiLlamaAPI:Ve,fetchPriceFromCoingeckoAPI:Ke,fetchPriceFromDefiLlama:Qe,fetchPriceFromCoingecko:ze,fetchLPPositions:$e,fetchLPPrice:tt,fetchStNEARPrice:nt,fetchPriceFromOracle:it,fetchUnderlyingTokensPrices:ut,fetchPrice:dt,fetchPLYPrice:mt,fetchPULPPrice:yt,fetchToken0PriceByLP:gt,fetchValuation:kt,calcValuation:At,valuateToken:Pt,TransferEventQuery:Lt,fetchHistoricalLPPositions:Rt,fetchHistoricalLPPrice:Et,fetchHistoricalPriceFromOracle:St,fetchHistoricalPrice:Dt,fetchHistoricalPULPPrice:It,fetchHistoricalPriceByLP:Mt},Yt=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new Le(t),r}return V(t,e),t.prototype.getRedeemableReward=function(){var e=H(Y().mark((function e(t,n,a){var o;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=new Re(n,ue(n)),e.next=3,this.env.auriAirdrop.getRedeemableReward(r.utils.formatBytes32String(t),n,a);case 3:return e.abrupt("return",new Ce(o,e.sent.toString()));case 5:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),t}(Ae),jt=function(e){function t(){return e.apply(this,arguments)||this}V(t,e);var n=t.prototype;return n.redeemMultiple=function(){var e=H(Y().mark((function e(t,n){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ee(t.length==n.length,"campaigns and tokens must have the same length"),e.t0=this.env.auriAirdrop.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=H(Y().mark((function e(t,r){return Y().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}(Yt),Ht=function(e){function t(){return e.call(this)||this}V(t,e);var r=t.prototype;return r.read=function(e){return new Yt(e)},r.readWrite=function(e){return new jt(e)},t}(_e),qt=function(e){function n(t,n,i){var s;return(s=e.call(this,t)||this).env=new Le(t),s.auToken=ne(i,T)?new r.Contract(n,o.abi,t.provider):new r.Contract(n,a.abi,t.provider),s.underlying=new Re(i,ue(i)),s}V(n,e);var i=n.prototype;return i.getUnderlyingPrice=function(){var e=H(Y().mark((function e(){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",dt(this.underlying.address,this._networkConnection.provider));case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getPlyPrice=function(){var e=H(Y().mark((function e(){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",dt(E.tokens.PLY,this._networkConnection.provider));case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getRewardSpeeds=function(){var e=H(Y().mark((function e(){return Y().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)}}(),i.getTotalTokenBorrowed=function(){var e=H(Y().mark((function e(){return Y().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)}}(),i.getTotalTokenDeposited=function(){var e=H(Y().mark((function e(){var t,n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getTotalTokenBorrowed(),this.auToken.getCash()]);case 2:return n=(t=e.sent)[0],e.abrupt("return",new Ce(this.underlying,r.BigNumber.from(new Ce(this.underlying,t[1].toString()).rawAmount()).add(n.rawAmount()).toString()));case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getDepositAPY=function(){var e=H(Y().mark((function e(){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.auToken.supplyRatePerTimestamp();case 2:return r=new t(e.sent.toString()).multipliedBy(86400).div(re(18)),e.abrupt("return",new t(r.plus(1)).pow(365).minus(1));case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getBorrowAPY=function(){var e=H(Y().mark((function e(){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.auToken.borrowRatePerTimestamp();case 2:return r=new t(e.sent.toString()).multipliedBy(86400).div(re(18)),e.abrupt("return",new t(r.plus(1)).pow(365).minus(1));case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getCollateralRatio=function(){var e=H(Y().mark((function e(){return Y().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(re(18))})));case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getBorrowPlyAPY=function(){var e=H(Y().mark((function e(){var t,r,n,a;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getTotalTokenBorrowed(),this.getRewardSpeeds(),this.getPlyPrice(),this.getUnderlyingPrice()]);case 2:return r=(t=e.sent)[0],n=t[2],a=t[3],e.abrupt("return",le(At(new Ce(Te,t[1].plyRewardBorrowSpeed.toString()),n),a.multipliedBy(r.formattedAmount()),31536e3));case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getDepositPlyAPY=function(){var e=H(Y().mark((function e(){var t,r,n,a;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getTotalTokenDeposited(),this.getRewardSpeeds(),this.getPlyPrice(),this.getUnderlyingPrice()]);case 2:return r=(t=e.sent)[0],n=t[2],a=t[3],e.abrupt("return",le(At(new Ce(Te,t[1].plyRewardSupplySpeed.toString()),n),a.multipliedBy(r.formattedAmount()),31536e3));case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getDepositNearAPY=function(){var e=H(Y().mark((function e(){var t,r,n,a;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getTotalTokenDeposited(),this.getUnderlyingPrice()]);case 2:return r=(t=e.sent)[0],n=t[1],e.t0=Wt,e.next=8,kt(this.getDepositNEARRewardPerWeek(),this._networkConnection.provider);case 8:return e.t1=e.sent,e.t2=n.multipliedBy(r.formattedAmount()),a=e.t0.calcLMRewardApr.call(e.t0,e.t1,e.t2,52),e.abrupt("return",a);case 12:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getBorrowNearAPY=function(){var e=H(Y().mark((function e(){var t,r,n,a;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getTotalTokenBorrowed(),this.getUnderlyingPrice()]);case 2:return r=(t=e.sent)[0],n=t[1],e.t0=Wt,e.next=8,kt(this.getBorrowNEARRewardPerWeek(),this._networkConnection.provider);case 8:return e.t1=e.sent,e.t2=n.multipliedBy(r.formattedAmount()),a=e.t0.calcLMRewardApr.call(e.t0,e.t1,e.t2,52),e.abrupt("return",a);case 12:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getDepositMetaAPY=function(){var e=H(Y().mark((function e(){var r,n,a,o;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getTotalTokenDeposited(),dt(this.underlying.address,this._networkConnection.provider)]);case 2:if(n=(r=e.sent)[0],a=r[1],!ne(this.underlying.address,E.tokens.stNEAR)){e.next=14;break}return e.t0=Wt,e.next=9,kt(Ce.fromAddressAndAmount(E.tokens.META,"750000",!1),this._networkConnection.provider);case 9:e.t1=e.sent,e.t2=a.multipliedBy(n.formattedAmount()),o=e.t0.calcLMRewardApr.call(e.t0,e.t1,e.t2,12),e.next=15;break;case 14:o=new t(0);case 15:return e.abrupt("return",o);case 16:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getDepositStaderAPY=function(){var e=H(Y().mark((function e(){var r,n,a,o;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(ae()<1675346400)){e.next=4;break}return e.abrupt("return",new t(0));case 4:return e.next=6,Promise.all([this.getTotalTokenDeposited(),dt(this.underlying.address,this._networkConnection.provider)]);case 6:if(n=(r=e.sent)[0],a=r[1],!ne(this.underlying.address,E.tokens.NEARX)){e.next=18;break}return e.t0=Wt,e.next=13,kt(Ce.fromAddressAndAmount(E.tokens.STADER,"95",!1),this._networkConnection.provider);case 13:e.t1=e.sent,e.t2=a.multipliedBy(n.formattedAmount()),o=e.t0.calcLMRewardApr.call(e.t0,e.t1,e.t2,365),e.next=19;break;case 18:o=new t(0);case 19:return e.abrupt("return",o);case 20:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getDetails=function(){var e=H(Y().mark((function e(){var t,r,n,a,o,i,s,u,c,p,l,f,d,h;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getTotalTokenDeposited(),this.getTotalTokenBorrowed(),this.getDepositAPY(),this.getBorrowAPY(),this.getCollateralRatio(),this.getRewardSpeeds()]);case 2:return r=(t=e.sent)[0],n=t[1],a=t[2],o=t[3],i=t[4],s=t[5],e.next=11,Promise.all([this.getDepositPlyAPY(),this.getBorrowPlyAPY(),this.getDepositNearAPY(),this.getBorrowNearAPY(),this.getDepositMetaAPY(),this.getDepositStaderAPY()]);case 11:return c=(u=e.sent)[0],p=u[1],l=u[2],f=u[3],d=u[4],h=u[5],e.abrupt("return",{auTokenAddress:this.auToken.address,totalTokenDeposited:r,totalTokenBorrowed:n,depositApy:a.toNumber(),depositPlyApy:c.toNumber(),borrowApy:o.toNumber(),borrowPlyApy:-1*p.toNumber(),collateralRatio:i.toNumber(),depositPlyPerWeek:new Ce(Te,s.plyRewardSupplySpeed.mul(86400).mul(7).toString()),borrowPlyPerWeek:new Ce(Te,s.plyRewardBorrowSpeed.mul(86400).mul(7).toString()),depositNEARApy:l.toNumber(),borrowNEARApy:-1*f.toNumber(),depositMETAApy:d.toNumber(),staderDepositApy:h.toNumber()});case 19:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getUserBorrowBalance=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),i.getUserDepositBalance=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),i.getDepositNEARRewardPerWeek=function(){var e=new Re(E.tokens.WNEAR,ue(E.tokens.WNEAR)),t=ae();if(t<=1651845600&&t>1650636e3){var r,n=null!=(r=I[this.underlying.address.toLocaleLowerCase()])?r:"0";return new Ce(e,n,!1)}return new Ce(e,"0")},i.getBorrowNEARRewardPerWeek=function(){var e=new Re(E.tokens.WNEAR,ue(E.tokens.WNEAR)),t=ae();if(t<=1651845600&&t>1650636e3){var r,n=null!=(r=O[this.underlying.address.toLocaleLowerCase()])?r:"0";return new Ce(e,n,!1)}return new Ce(e,"0")},i.mintCap=function(){var e=H(Y().mark((function e(){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Ce,e.t1=this.underlying,e.next=4,this.env.comptroller.mintCaps(this.auToken.address);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)}}(),i.borrowCap=function(){var e=H(Y().mark((function e(){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Ce,e.t1=this.underlying,e.next=4,this.env.comptroller.borrowCaps(this.auToken.address);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)}}(),i.getApyWithoutIncentive=function(){var e=H(Y().mark((function e(t){var r,n,a,o,i,s,u,c;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getUnderlyingPrice(),this.getDepositAPY(),this.getBorrowAPY(),this.getUserDepositBalance(t),this.getUserBorrowBalance(t)]);case 2:return a=(r=e.sent)[1],o=r[2],i=r[4],s=(n=r[0]).multipliedBy(r[3].formattedAmount()),u=n.multipliedBy(i.formattedAmount()),c=fe(s,a,u,o),e.abrupt("return",{sum:c,suppliedValue:s,borrowedValue:u});case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),i.getApyWithIncentive=function(){var e=H(Y().mark((function e(t){var r,n,a,o,i,s,u,c,p,l,f,d,h,m,w,y,v;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getUnderlyingPrice(),this.getDepositAPY(),this.getBorrowAPY(),this.getUserDepositBalance(t),this.getUserBorrowBalance(t),this.getDepositNearAPY(),this.getDepositPlyAPY(),this.getDepositMetaAPY(),this.getBorrowNearAPY(),this.getBorrowPlyAPY()]);case 2:return n=(r=e.sent)[0],a=r[1],o=r[2],i=r[3],s=r[4],u=r[5],c=r[6],p=r[7],l=r[8],f=r[9],e.next=15,this.getDepositStaderAPY();case 15:return d=e.sent,h=n.multipliedBy(i.formattedAmount()),m=n.multipliedBy(s.formattedAmount()),w=a.plus(u).plus(c).plus(p).plus(d),y=o.plus(l).plus(f),v=fe(h,w,m,y),e.abrupt("return",{sum:v,suppliedValue:h,borrowedValue:m});case 22:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n}(Ae);_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getUnderlyingPrice",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getPlyPrice",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getRewardSpeeds",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getTotalTokenBorrowed",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getTotalTokenDeposited",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getDepositAPY",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getBorrowAPY",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getCollateralRatio",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getBorrowPlyAPY",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getDepositPlyAPY",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getDepositNearAPY",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getBorrowNearAPY",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getDepositMetaAPY",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getDepositStaderAPY",null);var Vt,Gt,Kt=function(e){function n(t,n,a){var o;return(o=e.call(this,t,n,a)||this)._EthRepayHelper=new r.Contract(E.misc.ETHREPAYHELPER,f.abi,t.provider),o}V(n,e);var a=n.prototype;return a.deposit=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!ne(t.token.address,T)){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)}}(),a.borrow=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),a.withdraw=function(){var e=H(Y().mark((function e(r){return Y().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(U));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)}}(),a.repay=function(){var e=H(Y().mark((function e(r){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!ne(r.token.address,T)){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(U));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)}}(),a.enableCollateral=function(){var e=H(Y().mark((function e(){return Y().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)}}(),a.disableCollateral=function(){var e=H(Y().mark((function e(){return Y().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}(qt),Zt=function(e){function t(t,r){var n;return(n=e.call(this)||this).address=se(t),n.underlying=se(r),n}V(t,e);var r=t.prototype;return r.read=function(e){return new qt(e,this.address,this.underlying)},r.readWrite=function(e){return new Kt(e,this.address,this.underlying)},t}(_e),Qt=r.BigNumber.from(1e4),Xt=function(e){function n(t){var r;(r=e.call(this,t)||this).env=new Le(t);var n=E.tokens.PLY,a=E.tokens.PULP;return r.plyToken=new Re(n,ue(n)),r.pulpToken=new Re(a,ue(a)),r}V(n,e);var a=n.prototype;return a.getPlyBalance=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),a.getPulpBalance=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),a.getUnclaimedPlyReward=function(){var e=H(Y().mark((function e(t){return Y().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,D,{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)}}(),a.getWeek=function(e){return r.BigNumber.from(e-1651759200).div(604800).toNumber()},a.getLockingDetails=function(){var e=H(Y().mark((function e(n){var a,o,i,s,u,c,p,l,f,d,h,m;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=this.getWeek(ae()),e.next=3,Promise.all([this.env.auriLens.getPercentLock(this.env.pulp.address,n,a),this.env.auriLens.getPercentLock(this.env.pulp.address,n,a+1),this.getUnclaimedPlyReward(n)]);case 3:return i=r.BigNumber.from((o=e.sent)[0]),s=r.BigNumber.from(o[1]),u=o[2],e.next=9,this.env.pulp.calcLockAmount(n,u.rawAmount());case 9:return p=(c=e.sent)[0],l=c[1],f=s.mul(u.rawAmount()).div(Qt),d=r.BigNumber.from(u.rawAmount()).sub(f),h=Qt.sub(i).toString(),m=Qt.sub(s).toString(),e.abrupt("return",{vestingStart:1651759200,currentUnlockPortion:new t(h).dividedBy(100).toNumber(),accruedPly:u,currentPly:new Ce(this.plyToken,l.toString()),currentPulp:new Ce(this.pulpToken,p.toString()),nextUnlockPortion:new t(m).dividedBy(100).toNumber(),nextPly:new Ce(this.plyToken,f.toString()),nextPulp:new Ce(this.pulpToken,d.toString())});case 17:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),a.getTimestampToUnlock=function(){var e=H(Y().mark((function e(t,r){return Y().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)}}(),a.getNextWeekTimestamp=function(){return 1651759200+604800*(this.getWeek(ae())+1)},a.getUnlockPortionAt=function(){var e=H(Y().mark((function e(t,r){var n;return Y().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=Qt.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}(Ae),zt=function(e){function t(t){return e.call(this,t)||this}V(t,e);var r=t.prototype;return r.redeem=function(){var e=H(Y().mark((function e(t,r){return Y().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=H(Y().mark((function e(t){return Y().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}(Xt),Jt=function(e){function t(){return e.call(this)||this}V(t,e);var r=t.prototype;return r.read=function(e){return new Xt(e)},r.readWrite=function(e){return new zt(e)},t}(_e),$t=function(e){function t(t){var r;(r=e.call(this,t)||this).env=new Le(t);var n=E.tokens.PLY,a=E.tokens.PULP;return r.plyToken=new Re(n,ue(n)),r.pulpToken=new Re(a,ue(a)),r}V(t,e);var n=t.prototype;return n.parseBetMakeEvent=function(e){var t=["bigWin","win","lose","noImpact"][e.args.outcome],r=e.args.amount,n=r.mul([0,0,100,2][e.args.outcome]).div(100),a=r.mul([10,1,0,0][e.args.outcome]);return{player:e.args.player,lostAmount:new Ce(this.plyToken,n.toString()),unlockedPulpAmount:new Ce(this.pulpToken,a.toString()),outcome:t,transactionHash:e.transactionHash,block:e.blockNumber,timestamp:0}},n.attachTimestamp=function(){var e=H(Y().mark((function e(t){var r,n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.map((function(e){return e.block})),e.next=3,ye(this._networkConnection.provider,r);case 3:return n=e.sent,e.abrupt("return",t.map((function(e,t){return q({},e,{timestamp:n[t]})})));case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.getUserPlyGameHistory=function(){var e=H(Y().mark((function e(t){var r,n,a,o=this;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.plygame.getLastBlock(t,100);case 2:if(!(r=e.sent).eq(0)){e.next=5;break}return e.abrupt("return",[]);case 5:return n=this.env.plygame.filters.BetMade(t),e.next=8,this.env.plygame.queryFilter(n,r.toNumber());case 8:return xe(a=e.sent).reverse(),e.abrupt("return",this.attachTimestamp(a.map((function(e){return o.parseBetMakeEvent(e)}))));case 11:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.currentJackpotAmount=function(){var e=H(Y().mark((function e(){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.plygame.currentJackpotAmount();case 2:return e.abrupt("return",new Ce(this.plyToken,e.sent.toString()));case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),n.earlyUnlockedPulpAmount=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.plygame.totalPlyUnlockedEarly(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)}}(),n.getPlyGameResultsInTransaction=function(){var e=H(Y().mark((function e(t){var r,n,a,o,i=this;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._networkConnection.provider.getTransactionReceipt(t);case 2:r=e.sent,n=0;case 4:if(!(n<100)||r){e.next=13;break}return e.next=7,oe(1e3);case 7:return e.next=9,this._networkConnection.provider.getTransactionReceipt(t);case 9:r=e.sent;case 10:n++,e.next=4;break;case 13:if(r){e.next=15;break}throw new Error("Transaction "+t+" takes too long to be mined");case 15:return a=this.env.plygame.filters.BetMade(),o=r.logs.filter((function(e){return ne(e.topics[0],a.topics[0])})).map((function(e){return q({},i.env.plygame.interface.parseLog(e),{blockNumber:r.blockNumber,transactionHash:t})})),e.abrupt("return",this.attachTimestamp(o.map((function(e){return i.parseBetMakeEvent(e)}))));case 18:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.leaderboard=function(){var e=H(Y().mark((function e(){var t=this;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,He("/plygame/leaderboard");case 2:return e.abrupt("return",e.sent.items.map((function(e,r){return{player:e.user,unlockedPulpAmount:new Ce(t.pulpToken,e.unlockedAmount),gamesPlayed:e.count}})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),n.getLastJackpotResult=function(){var e=H(Y().mark((function e(){var t,n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=r.BigNumber,e.next=3,this._networkConnection.provider.getStorageAt(this.env.plygame.address,158);case 3:return e.t1=e.sent,t=e.t0.from.call(e.t0,e.t1),e.next=7,this.env.plygame.jackpotHistory(t.sub(1));case 7:return e.abrupt("return",{winner:(n=e.sent).winner.slice(0,5)+"..."+n.winner.slice(-3),amount:new Ce(this.plyToken,n.amount.toString())});case 9:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),n.overallLeaderboard=function(){var e=H(Y().mark((function e(){var t=this;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,He("/plygame/overallLeaderboard");case 2:return e.abrupt("return",e.sent.items.map((function(e){return{player:e.user,unlockedPulpAmount:new Ce(t.pulpToken,e.unlockedAmount),gamesPlayed:e.count}})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),t}(Ae),er=function(e){function t(){return e.apply(this,arguments)||this}V(t,e);var r=t.prototype;return r.makeBetOnce=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.plygame.connect(this._networkConnection.signer).makeBetOnce(t.rawAmount()));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.approve=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.ply.connect(this._networkConnection.signer).approve(this.env.plygame.address,t.rawAmount()));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}($t),tr=function(e){function t(){return e.call(this)||this}V(t,e);var r=t.prototype;return r.read=function(e){return new $t(e)},r.readWrite=function(e){return new er(e)},t}(_e),rr=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new Le(t),r}return V(t,e),t.prototype.remainingEarlyUnlockPulp=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.pulp.earlyRedeems(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(Ae),nr=function(e){function t(){return e.apply(this,arguments)||this}return V(t,e),t.prototype.convertEarlyPulp=function(){var e=H(Y().mark((function e(t,n){var a;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=r.BigNumber.from(n.rawAmount()),e.abrupt("return",this.env.pulp.connect(this._networkConnection.signer).redeem(t,a));case 2:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t}(rr),ar=function(e){function t(){return e.call(this)||this}V(t,e);var r=t.prototype;return r.read=function(e){return new rr(e)},r.readWrite=function(e){return new nr(e)},t}(_e),or=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new Le(t),r}V(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=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.referralDirectoryV2.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=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.referralDirectoryV2.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=H(Y().mark((function e(t){var n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.ethers.utils.formatBytes32String(t),e.abrupt("return",this.env.referralDirectoryV2.referralCodeOwner(n));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.getReferralsList=function(){var e=H(Y().mark((function e(t){var r,n,a,o;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,He("/referral/list",{address:t});case 2:return n=(r=e.sent).items.map((function(e){return e.blockNumber})),e.next=6,ye(this._networkConnection.provider,n);case 6:return a=e.sent,o=r.items.map((function(e,t){return{user:e.user,timestamp:a[t]}})),e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.referralRewards=function(){var e=H(Y().mark((function e(t){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,He("/referral/rewards",{address:t});case 2:return r=e.sent.items.map((function(e,r){var n;return{campaign:e.campaign,userAddr:t,isReferrer:e.campaign.includes("referrer"),rewardTokenAmount:Ce.fromAddressAndAmount(e.token,e.amount),startTime:F[e.campaign].start,endTime:F[e.campaign].end,transactionHash:null!=(n=e.transactionHash)?n:null,refereeAddress:null}})),e.abrupt("return",r);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.leaderboard=function(){var e=H(Y().mark((function e(t){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,He("/referral/leaderboard",{campaign:t});case 2:return(r=e.sent.items.map((function(e,r){return{campaign:t,userAddr:e.user,isReferrer:e.campaign.includes("referrer"),rewardTokenAmount:Ce.fromAddressAndAmount(e.token,e.amount),startTime:F[e.campaign].start,endTime:F[e.campaign].end,transactionHash:null,refereeAddress:null}}))).sort((function(e,t){return t.rewardTokenAmount.compare(e.rewardTokenAmount)})),e.abrupt("return",r);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.slotsInUse=function(){var e=H(Y().mark((function e(){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ye("/referral/slotsInUse");case 2:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),n.totalReferralSlots=function(){return 500},n.queuePosition=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ye("/referral/queuePosition",{address:t});case 2:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.userReferralStatus=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ye("/referral/referralStatus",{address:t});case 2:e.t0=e.sent,e.next=-1===e.t0?6:0===e.t0?7:1===e.t0?8:9;break;case 6:return e.abrupt("return","notReferred");case 7:return e.abrupt("return","notQualified");case 8:return e.abrupt("return","Qualified");case 9:return e.abrupt("return","Withdrawn");case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.isWhitelistedAddress=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.referralDirectoryV2.isUserWhitelisted(t);case 2:return e.abrupt("return",e.sent.eq(1));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.isOnAuroraPlus=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,A.get("https://aurora.plus/api/wallet/"+t);case 2:return e.abrupt("return","active"==e.sent.data.status);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.isNewUserAtReferralTime=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ye("/referral/isNewUser",{address:t});case 2:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.depositedMoreThanMinimumAmount=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ye("/referral/depositedEnough",{address:t});case 2:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t}(Ae),ir=function(e){function t(){return e.apply(this,arguments)||this}V(t,e);var n=t.prototype;return n.registerNewReferralCode=function(){var e=H(Y().mark((function e(){var t;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.ethers.utils.formatBytes32String(this.generateReferralCode()),e.abrupt("return",this.env.referralDirectoryV2.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=H(Y().mark((function e(t){var n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.ethers.utils.formatBytes32String(t),e.abrupt("return",this.env.referralDirectoryV2.connect(this._networkConnection.signer).registerReferralCodeUsed(n));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.claimReferralRewards=function(){var e=H(Y().mark((function e(){var t,r,n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=this,e.next=3,this._networkConnection.signer.getAddress();case 3:return e.t1=e.sent,e.next=6,e.t0.referralRewards.call(e.t0,e.t1);case 6:return t=e.sent.filter((function(e){return null==e.transactionHash})),r=t.map((function(e){return e.campaign})),n=t.map((function(e){return e.rewardTokenAmount.token.address})),e.abrupt("return",new jt(this._networkConnection).redeemMultiple(r,n));case 10:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t}(or),sr=function(e){function t(){return e.call(this)||this}V(t,e);var r=t.prototype;return r.read=function(e){return new or(e)},r.readWrite=function(e){return new ir(e)},t}(_e),ur=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new Le(t),r}V(t,e);var n=t.prototype;return n.getPLYWNEARPoolDetails=function(){var e=H(Y().mark((function e(){var t,r,n,a,o,i,s,u,c;return Y().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(Ee,t.toString()),e.next=5,kt(n,this._networkConnection.provider);case 5:for(a=e.sent,o=[],i=0;i<r.length;i++)u=new Re(s=N[i],ue(s)),o.push(kt(new Ce(u,r[i].toString()),this._networkConnection.provider));return c=[],e.next=11,Promise.all(o);case 11:return e.sent.forEach((function(e,t){var r=N[t],n=le(e,a,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=H(Y().mark((function e(t){return Y().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(Ee,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=H(Y().mark((function e(t){var n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new r.Contract(E.tokens.PLYWNEAR,d.abi,this._networkConnection.provider),e.next=3,n.balanceOf(t);case 3:return e.abrupt("return",new Ce(Ee,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=H(Y().mark((function e(t){return Y().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(N[t],e.toString())})));case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(Ae),cr=function(e){function t(){return e.apply(this,arguments)||this}V(t,e);var n=t.prototype;return n.stake=function(){var e=H(Y().mark((function e(t){return Y().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=H(Y().mark((function e(t){var n,a,o,i;return Y().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,a=r.BigNumber.from(t.rawAmount()),e.t0=r.BigNumber,e.next=7,this.stakeBalanceOf(n);case 7:return e.t1=e.sent.rawAmount(),o=e.t0.from.call(e.t0,e.t1),i=a.lt(o)?a:o.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}(ur),pr=function(e){function t(){return e.call(this)||this}V(t,e);var r=t.prototype;return r.read=function(e){return new ur(e)},r.readWrite=function(e){return new cr(e)},t}(_e);(Vt=exports.ComptrollerRewardType||(exports.ComptrollerRewardType={}))[Vt.PLY=0]="PLY",Vt[Vt.AURORA=1]="AURORA",(Gt=exports.MarketAction||(exports.MarketAction={}))[Gt.Deposit=0]="Deposit",Gt[Gt.Borrow=1]="Borrow",Gt[Gt.Withdraw=2]="Withdraw",Gt[Gt.Repay=3]="Repay",Gt[Gt.EnableCollateral=4]="EnableCollateral",Gt[Gt.DisableCollateral=5]="DisableCollateral";var lr=function(e){function t(t){var n;return(n=e.call(this,t)||this).multicall=new r.Contract(E.misc.MULTICALL,w.abi,t.provider),n}return V(t,e),t.prototype.aggregate=function(){var e=H(Y().mark((function e(t){var n,a,o,i,s,u,c,p;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=[],a=0;case 2:if(!(a<t.length)){e.next=11;break}return i=t[a],e.next=6,(o=i.contract.populateTransaction)[i.method].apply(o,i.args);case 6:n.push({target:(s=e.sent).to,callData:s.data});case 8:a++,e.next=2;break;case 11:return e.next=13,this.multicall.callStatic.aggregate(n);case 13:for(u=e.sent,c=[],p=0;p<t.length;p++)c.push(r.ethers.utils.defaultAbiCoder.decode(t[p].returnTypes,u.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}(Ae),fr=function(e){function n(t){var r;return(r=e.call(this,t)||this).stakingRead=new ur(t),r.env=new Le(t),r}V(n,e);var a=n.prototype;return a.getUserDetails=function(){var e=H(Y().mark((function e(r){var n,a,o,i,s,u,c,p,l,f,d,h,m,w,y,v,g,b,k,x,A,P,_,L;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=E.auTokens.length,a=[],i=new t(0),s=K(E.auTokens);case 4:if((u=s()).done){e.next=23;break}return c=u.value,a.push(p={}),p.market=c.underlying,l=new qt(this._networkConnection,c.address,c.underlying),e.next=12,Promise.all([l.getUserDepositBalance(r),l.getUserBorrowBalance(r),l.getCollateralRatio(),dt(l.underlying.address,this._networkConnection.provider)]);case 12:d=(f=e.sent)[1],h=f[2],m=f[3],p.depositBalance=f[0],p.borrowBalance=d,p.collateralRatio=h.toNumber(),p.underlyingPrice=m.toString();case 21:e.next=4;break;case 23:return e.next=25,this.env.comptroller.getAssetsIn(r);case 25:o=e.sent,w=[],y=Y().mark((function e(){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=E.auTokens[v],a[v].isCollateral=void 0!==o.find((function(e){return ne(r.address,e)})),w.push(At(a[v].depositBalance,new t(a[v].underlyingPrice)));case 3:case"end":return e.stop()}}),e)})),v=0;case 29:if(!(v<n)){e.next=34;break}return e.delegateYield(y(),"t0",31);case 31:v++,e.next=29;break;case 34:return i=w.reduce((function(e,t,r){return a[r].isCollateral?e.plus(t.multipliedBy(a[r].collateralRatio)):e}),new t(0)),e.next=37,this.env.comptroller.getAccountLiquidity(r);case 37:for((g=i.minus(new t(e.sent[0].toString()).div(re(18)))).lt("0.00001")&&(g=new t(0)),b=i.multipliedBy(S),k=g.div(S),x=b.lte(g)?new t(0):b.minus(g),v=0;v<n;v++)P=new qt(this._networkConnection,(A=E.auTokens[v]).address,A.underlying),_=i.minus(k).gt(0)?i.minus(k):new t(0),L=_.div(a[v].collateralRatio).div(a[v].underlyingPrice),a[v].maxWithdrawableAmount=a[v].isCollateral&&L.lt(a[v].depositBalance.formattedAmount())?new Ce(P.underlying,L.toFixed(24),!1):new Ce(P.underlying,a[v].depositBalance.rawAmount());return e.t1=a,e.t2={currency:"USD",amount:b.toFixed(10)},e.next=48,new Xt(this._networkConnection).getLockingDetails(r);case 48:return e.t3=e.sent,e.t4={currency:"USD",amount:x.toFixed(10)},e.abrupt("return",{markets:e.t1,borrowLimit:e.t2,userLockingDetails:e.t3,borrowableAmount:e.t4});case 51:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),a.getTokenPrice=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,dt(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)}}(),a.calcHypotheticalStats=function(e){var r=e.userMarketDetail,n=e.currentBorrowValuation,a=e.action,o=e.tokenAmount,i=new t(e.currentBorrowLimit.amount),s=new t(n.amount);switch(a){case exports.MarketAction.EnableCollateral:case exports.MarketAction.DisableCollateral:var u=At(r.depositBalance,new t(r.underlyingPrice)).multipliedBy(r.collateralRatio).multipliedBy(S);i=a==exports.MarketAction.EnableCollateral?i.plus(u):i.minus(u);break;case exports.MarketAction.Deposit:case exports.MarketAction.Withdraw:u=At(o,new t(r.underlyingPrice)).multipliedBy(r.collateralRatio).multipliedBy(S),i=a==exports.MarketAction.Deposit?i.plus(u):i.minus(u);break;case exports.MarketAction.Borrow:case exports.MarketAction.Repay:var c=At(o,new t(r.underlyingPrice));s=a==exports.MarketAction.Borrow?s.plus(c):s.minus(c)}return{newBorrowLimit:{amount:i.toFixed(10),currency:"USD"},newBorrowUtilization:i.eq(0)?s.eq(0)?0:9999.99:s.div(i).toNumber()}},a.getPlyCirculatingSupply=function(){var e=H(Y().mark((function e(){var t,n,a,o,i;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new lr(this._networkConnection),n={contract:this.env.ply,method:"balanceOf",returnTypes:["uint256"]},a=[E.misc.TEAM_MULTISIG,E.misc.COMPTROLLER,E.misc.AURIFAIRLAUNCH,E.misc.PLY_TOKEN_LOCK,E.misc.TEAM_MULTISIG_AURORA_PLUS,E.misc.AURORA_PLUS,E.misc.PULP_CONTRACT].map((function(e){return q({},n,{args:[e]})})),e.next=6,t.aggregate(a);case 6:return o=e.sent,i=r.BigNumber.from("1"+"0".repeat(10)+"0".repeat(ue(this.env.ply.address))),o.forEach((function(e,t){i=i.sub(e[0])})),e.abrupt("return",new Ce(Te,i.toString()));case 10:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),a.getUtilisation=function(){var e=H(Y().mark((function e(r){var n,a,o;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriInternalLens.callStatic.getAccountLiquidityAccrueInterest(r);case 2:return a=new t((n=e.sent).sumBorrowPlusEffects.toString()),o=new t(n.sumCollateral.toString()),e.abrupt("return",a.dividedBy(o));case 6:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),a.sneakAccounts=function(){var e=H(Y().mark((function e(n,a,o){var i,s,u,l,f,d,h,m,w,y,v,g,b,k,x,A,P=this;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===o&&(o=new t(.1)),i=r.BigNumber.from(10).pow(18),s=this.env.getContract(E.misc.oracle,c.abi),u=a.map((function(e){return P.env.getContract(e,p.abi)})),e.next=6,s.getUnderlyingPrices(a);case 6:return l=e.sent,e.next=9,this.env.auriInternalLens.callStatic.getExchangeRates(a);case 9:f=e.sent,d=[],h=K(n);case 12:if((m=h()).done){e.next=33;break}w=m.value,y=[],v=0;case 16:if(!(v<u.length)){e.next=30;break}return e.next=19,u[v].getAccountSnapshot(w);case 19:if(b=(g=e.sent)[0].mul(f[v]).div(i).mul(l[v]).div(i),k=g[1].mul(l[v]).div(i),x=new t(b.toString()).dividedBy(i.toString()),A=new t(k.toString()).dividedBy(i.toString()),!x.lte(o)||!A.lte(o)){e.next=26;break}return e.abrupt("continue",27);case 26:y.push({token:ce(a[v]),deposit:x,borrow:A});case 27:++v,e.next=16;break;case 30:d.push({address:w,tokens:y});case 31:e.next=12;break;case 33:return e.abrupt("return",d);case 34:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),a.getNetApyWithoutIncentive=function(){var e=H(Y().mark((function e(r){var n,a,o,i,s,u,c,p=this;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new t(0),a=new t(0),o=new t(0),i=new t(0),e.next=6,Promise.all(E.auTokens.map((function(e){return new qt(p._networkConnection,e.address,e.underlying).getApyWithoutIncentive(r)})));case 6:for(s=K(e.sent);!(u=s()).done;)n=n.plus((c=u.value).sum),a=a.plus(c.suppliedValue),o=o.plus(c.borrowedValue);return n.gt(0)?i=n.div(a):n.lt(0)&&(i=n.div(o)),e.abrupt("return",i);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),a.getNetApyWithIncentive=function(){var e=H(Y().mark((function e(r){var n,a,o,i,s,u,c,p=this;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new t(0),a=new t(0),o=new t(0),i=new t(0),e.next=6,Promise.all(E.auTokens.map((function(e){return new qt(p._networkConnection,e.address,e.underlying).getApyWithIncentive(r)})));case 6:for(s=K(e.sent);!(u=s()).done;)n=n.plus((c=u.value).sum),a=a.plus(c.suppliedValue),o=o.plus(c.borrowedValue);return n.gt(0)?i=n.div(a):n.lt(0)&&(i=n.div(o)),e.abrupt("return",i);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n}(Ae),dr=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new Le(t),r}return V(t,e),t.prototype.getClaimableAmount=function(){var e=H(Y().mark((function e(t){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.plyTokenLock.callStatic.claimableBalance(t);case 2:return r=e.sent,e.abrupt("return",new Ce(new Re(Te.address,18),r.toString(),!0));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(Ae),hr=function(e){function t(){return e.apply(this,arguments)||this}return V(t,e),t.prototype.claim=function(){var e=H(Y().mark((function e(t,n){var a;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=r.BigNumber.from(n.rawAmount()),e.next=3,this.env.plyTokenLock.connect(this._networkConnection.signer).claim(t,a);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t}(dr),mr=function(e){function t(){return e.call(this)||this}V(t,e);var r=t.prototype;return r.read=function(e){return new dr(e)},r.readWrite=function(e){return new hr(e)},t}(_e);function wr(e,t){return yr.apply(this,arguments)}function yr(){return(yr=H(Y().mark((function e(t,r){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,A.post("https://api.aurigami.finance/notification/"+t,r,{headers:{"Content-Type":"application/json"}});case 2:return e.abrupt("return",e.sent.data);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var vr=function(e){function r(t){var r;return(r=e.call(this,t)||this).env=new Le(t),r._stakingRead=new ur(t),r._misc=new fr(t),r}V(r,e);var n=r.prototype;return n.getUserDetails=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),n.getPLYWNEARPoolDetails=function(){var e=H(Y().mark((function e(){return Y().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)}}(),n.getTokenPrice=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),n.stakeBalanceOf=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),n.LpBalanceOf=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),n.unclaimedRewardsOf=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),n.calcHypotheticalStats=function(e){return this._misc.calcHypotheticalStats({userMarketDetail:e.userMarketDetail,currentBorrowLimit:e.currentBorrowLimit,currentBorrowValuation:e.currentBorrowValuation,action:e.action,tokenAmount:e.tokenAmount})},n.getPlyCirculatingSupply=function(){var e=H(Y().mark((function e(){return Y().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)}}(),n.getUtilisation=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._misc.getUtilisation(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.sneakAccounts=function(){var e=H(Y().mark((function e(r,n,a){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===a&&(a=new t(.1)),e.abrupt("return",this._misc.sneakAccounts(r,n,a));case 2:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),n.getNetApyWithoutIncentive=function(){var e=H(Y().mark((function e(t){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new fr(this._networkConnection),e.abrupt("return",r.getNetApyWithoutIncentive(t));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.getNetApyWithIncentive=function(){var e=H(Y().mark((function e(t){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new fr(this._networkConnection),e.abrupt("return",r.getNetApyWithIncentive(t));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.setUserNotificationSettings=function(){var e=H(Y().mark((function e(t,r,n,a,o){var i;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={address:t,mail:r,setting:{utilisation:n,liquidation:a},captchaResponse:o},e.next=3,wr("alert-setting/set",i);case 3:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})));return function(t,r,n,a,o){return e.apply(this,arguments)}}(),n.unsetUserNotificationSettings=function(){var e=H(Y().mark((function e(t,r){var n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={address:t,mail:"",setting:{utilisation:null,liquidation:!1},captchaResponse:r},e.next=3,wr("alert-setting/set",n);case 3:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),n.getUserNotificationSettings=function(){var e=H(Y().mark((function e(t){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={addresses:t},e.next=3,wr("alert-setting/get-user-setting",r);case 3:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r}(Ae),gr=function(e){function t(){return e.apply(this,arguments)||this}V(t,e);var r=t.prototype;return r.claim=function(){var e=H(Y().mark((function e(){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.auriLens.connect(this._networkConnection.signer).claimRewards(this.env.comptroller.address,this.env.auriFairLaunch.address,D));case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.stake=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new cr(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=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new cr(this._networkConnection).unstake(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(vr),br=function(e){function t(){return e.call(this)||this}V(t,e);var r=t.prototype;return r.read=function(e){return new vr(e)},r.readWrite=function(e){return new gr(e)},t}(_e);r.ethers.utils.Logger.setLogLevel(n.Logger.levels.ERROR),t.config({DECIMAL_PLACES:50}),exports.MAINNET_ADDRESSES=k,exports.TESTNET_ADDRESSES=x,exports.AIRDROP_END_TIMESTAMP=1651068e3,exports.AIRDROP_KEEP_THRESHOLD=604800,exports.AIRDROP_START_TIMESTAMP=1649858400,exports.ALL_STAKING_POOLS=D,exports.AURORA_CHAINID=1313161554,exports.AURORA_PLUS_API_PREFIX="https://aurora.plus/api/wallet/",exports.Airdrop=Ht,exports.AirdropRead=Yt,exports.AirdropReadWrite=jt,exports.AuriEnv=Le,exports.BORROW_LIMIT_BUFFER=S,exports.BORROW_NEAR_REWARDS_PER_WEEK=O,exports.BlockchainEntity=_e,exports.BlockchainEntityRead=Ae,exports.BlockchainEntityReadWrite=Pe,exports.CACHE_TIMEOUT=1e4,exports.DECIMAL_PRECISION=10,exports.DEPOSIT_NEAR_REWARDS_PER_WEEK=I,exports.DEPOSIT_ONLY_TOKENS=C,exports.ETHAddress=T,exports.HARDCODE_PRICE_TOKENS=M,exports.INF=U,exports.MiscRead=fr,exports.MoneyMarket=Zt,exports.MoneyMarketRead=qt,exports.MoneyMarketReadWrite=Kt,exports.ONE_DAY=86400,exports.ONE_WEEK=604800,exports.ONE_YEAR=31536e3,exports.PLYToken=Te,exports.PLYWNEARToken=Ee,exports.PLYWNEAR_POOL_ID=0,exports.PLYWNEAR_REWARD_TOKENS=N,exports.PRICE_WHITELISTED=B,exports.Papermill=Jt,exports.PapermillRead=Xt,exports.PapermillReadWrite=zt,exports.PlyGame=tr,exports.PlyGameRead=$t,exports.PlyGameReadWrite=er,exports.PlyTokenLock=mr,exports.PlyTokenLockRead=dr,exports.PlyTokenLockReadWrite=hr,exports.Pulp=ar,exports.PulpRead=rr,exports.PulpReadWrite=nr,exports.REFERRAL_CAMPAIGNS=F,exports.REWARD_CLAIM_START=1651759200,exports.Referral=sr,exports.ReferralRead=or,exports.ReferralReadWrite=ir,exports.SDK=br,exports.SD_INCENTIVE_IN_SD=83.35,exports.SdkRead=vr,exports.SdkReadWrite=gr,exports.Staking=pr,exports.StakingRead=ur,exports.StakingReadWrite=cr,exports.Token=Re,exports.TokenAmount=Ce,exports.TransferEventQuery=Lt,exports.abis=R,exports.assert=ee,exports.calcLMRewardApr=le,exports.calcNetApy=fe,exports.calcValuation=At,exports.decimalFactor=re,exports.decimalRecords=W,exports.devLog=ke,exports.dummyAddress="0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE",exports.dummyMarketAddress="0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f",exports.dummyPly=Se,exports.dummyPlyAurora=Ne,exports.dummyToken=Be,exports.dummyTokenAmount=De,exports.dummyTokenAmount2=Ie,exports.dummyTokenAmount3=Oe,exports.dummyUserMarketDetails=Me,exports.dummyZeroTokenAmount=Ue,exports.fetchHistoricalLPPositions=Rt,exports.fetchHistoricalLPPrice=Et,exports.fetchHistoricalPULPPrice=It,exports.fetchHistoricalPrice=Dt,exports.fetchHistoricalPriceByLP=Mt,exports.fetchHistoricalPriceFromOracle=St,exports.fetchLPPositions=$e,exports.fetchLPPrice=tt,exports.fetchPLYPrice=mt,exports.fetchPULPPrice=yt,exports.fetchPrice=dt,exports.fetchPriceFromCoingecko=ze,exports.fetchPriceFromCoingeckoAPI=Ke,exports.fetchPriceFromDefiLlama=Qe,exports.fetchPriceFromDefiLlamaAPI=Ve,exports.fetchPriceFromOracle=it,exports.fetchStNEARPrice=nt,exports.fetchToken0PriceByLP=gt,exports.fetchUnderlyingTokensPrices=ut,exports.fetchValuation=kt,exports.formatObject=te,exports.getApi=Ye,exports.getBlockBeforeTimestamp=ge,exports.getBlockTimestamp=de,exports.getBlocksTimestamp=ye,exports.getBlocksTimestampViaRPC=me,exports.getCurrentTimestamp=ae,exports.getDecimal=ue,exports.getPaginatedApi=He,exports.getQuery=Q,exports.getSymbol=ce,exports.getUnderlying=pe,exports.isSameAddress=ne,exports.networkAddresses=E,exports.queryGraphQL=J,exports.referralRewardDummy1=Fe,exports.referralRewardDummy2=We,exports.sleep=oe,exports.sortEvents=xe,exports.symbolRecords=Z,exports.validateAndParseAddress=se,exports.valuateToken=Pt;
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"),a=e(require("@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json")),o=e(require("@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json")),i=e(require("@aurigami/contracts/artifacts/contracts/AuriAirdrop.sol/AuriAirdrop.json")),s=e(require("@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json")),u=e(require("@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json")),c=e(require("@aurigami/contracts/artifacts/contracts/AuriOracle.sol/AuriOracle.json")),p=e(require("@aurigami/contracts/artifacts/contracts/AuToken.sol/AuToken.json")),l=e(require("@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json")),f=e(require("@aurigami/contracts/artifacts/contracts/EthRepayHelper.sol/EthRepayHelper.json")),d=e(require("@aurigami/contracts/artifacts/contracts/interfaces/EIP20Interface.sol/EIP20Interface.json")),h=e(require("@aurigami/contracts/artifacts/contracts/mock/AuriInternalLens.sol/AuriInternalLens.json")),m=e(require("@aurigami/contracts/artifacts/contracts/mock/IUniswapV2Pair.sol/IUniswapV2Pair.json")),w=e(require("@aurigami/contracts/artifacts/contracts/mock/Multicall2.sol/Multicall2.json")),y=e(require("@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json")),v=e(require("@aurigami/contracts/artifacts/contracts/ReferralDirectoryV2.sol/ReferralDirectoryV2.json")),g=e(require("@aurigami/contracts/artifacts/contracts/plygame/PlyGame.sol/PlyGame.json")),b=e(require("@aurigami/contracts/artifacts/contracts/PlyTokenLock.sol/PlyTokenLock.json")),k=e(require("@aurigami/contracts/deployments/aurora_mainnet.json")),x=e(require("@aurigami/contracts/deployments/aurora_testnet.json")),A=e(require("axios")),P=require("@ethersproject/abstract-signer"),_=require("tslib"),L=require("cache-decorator"),R={__proto__:null,AuriOracleABI:c,AuTokenABI:p,IUniswapV2PairABI:m,AuriAirdropABI:i,AuriFairLaunchABI:s,AuriLensABI:u,ComptrollerABI:l,EIP20InterfaceABI:d,ReferralDirectoryV2ABI:v,AuErc20ABI:a,AuETHABI:o,EthRepayHelperABI:f,Multicall2ABI:w,PulpABI:y,AuriInternalLensABI:h,PlyGameABI:g,PlyTokenLockABI:b},T="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",E={auTokens:[{name:"auUSDC",address:k.auTokens.USDC.toLowerCase(),underlying:"0xb12bfca5a55806aaf64e99521918a4bf0fc40802".toLowerCase()},{name:"auETH",address:k.auTokens.ETH.toLowerCase(),underlying:T.toLowerCase()},{name:"auWBTC",address:k.auTokens.WBTC.toLowerCase(),underlying:"0xf4eb217ba2454613b15dbdea6e5f22276410e89e".toLowerCase()},{name:"auUSDT",address:k.auTokens.USDT.toLowerCase(),underlying:"0x4988a896b1227218e4a686fde5eabdcabd91571f".toLowerCase()},{name:"auDAI",address:k.auTokens.DAI.toLowerCase(),underlying:"0xe3520349f477a5f6eb06107066048508498a291b".toLowerCase()},{name:"auWNEAR",address:k.auTokens.WNEAR.toLowerCase(),underlying:"0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d".toLowerCase()},{name:"auSTNEAR",address:k.auTokens.STNEAR.toLowerCase(),underlying:"0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30".toLowerCase()},{name:"auAURORA",address:k.auTokens.AURORA.toLowerCase(),underlying:"0x8bec47865ade3b172a928df8f990bc7f2a3b9f79".toLowerCase()},{name:"auTRI",address:k.auTokens.TRI.toLowerCase(),underlying:"0xFa94348467f64D5A457F75F8bc40495D33c65aBB".toLowerCase()},{name:"auPLY",address:k.auTokens.PLY.toLowerCase(),underlying:"0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f".toLowerCase()},{name:"auUSN",address:k.auTokens.USN.toLowerCase(),underlying:"0x5183e1b1091804bc2602586919e6880ac1cf2896".toLowerCase()},{name:"auNEARX",address:k.auTokens.NEARX.toLowerCase(),underlying:"0xb39eeb9e168ef6c639f5e282fef1f6bc4dcae375".toLowerCase()}],misc:{COMPTROLLER:k.comptroller.toLowerCase(),oracle:k.oracle.toLowerCase(),AURIFAIRLAUNCH:k.fairLaunch.toLowerCase(),AURILENS:k.auriLens.toLowerCase(),ETHREPAYHELPER:k.ethRepayHelper.toLowerCase(),AURI_AIRDROP:k.auriAirdrop.toLowerCase(),MULTICALL:k.multicall.toLowerCase(),TEAM_MULTISIG:"0x2D05FfFE70CE64c5954710D4C308dB31C8dBd8dE".toLowerCase(),TEAM_MULTISIG_AURORA_PLUS:"0x31f501589c7a090bf68f2fe2687744bf9130e1ab".toLowerCase(),AURORA_PLUS:"0xf075c896cbbb625e7911e284cd23ee19bdccf299".toLowerCase(),PULP_CONTRACT:"0x04ac48711bcdc45b4d223fb021e09da73c71095e".toLowerCase(),PLY_TOKEN_LOCK:k.plyTokenLock.toLowerCase(),REFERRAL:k.referralDirectory.toLowerCase(),REFERRAL_V2:"0xCECd147409B2d64A9A2E5418e3E471E8af19E0bd".toLowerCase(),AURI_INTERNAL_LENS:k.auriInternalLens.toLowerCase(),PLYGAME:k.plyGame.toLowerCase()},tokens:{AURORA:"0x8bec47865ade3b172a928df8f990bc7f2a3b9f79".toLowerCase(),PLY:"0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f".toLowerCase(),stNEAR:"0x07f9f7f963c5cd2bbffd30ccfb964be114332e30".toLowerCase(),USDC:"0xb12bfca5a55806aaf64e99521918a4bf0fc40802".toLowerCase(),WNEAR:"0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d".toLowerCase(),TRI:"0xFa94348467f64D5A457F75F8bc40495D33c65aBB".toLowerCase(),META:"0xc21ff01229e982d7c8b8691163b0a3cb8f357453".toLowerCase(),PULP:k.PULP.toLowerCase(),PLYWNEAR:k.ply_wnear_lp.toLowerCase(),USN:"0x5183e1b1091804bc2602586919e6880ac1cf2896".toLowerCase(),PLY_WNEAR:"0x044b6b0cd3bb13d2b9057781df4459c66781dce7".toLowerCase(),WNEAR_TRI:"0x84b123875f0f36b966d0b6ca14b31121bd9676ad".toLowerCase(),AURORA_WNEAR:"0x1e0e812fbcd3eb75d8562ad6f310ed94d258d008".toLowerCase(),NEARX:"0xb39eeb9e168ef6c639f5e282fef1f6bc4dcae375".toLowerCase(),STADER:"0x078e103d5f9629ac48b8563fa2bfcd2f6d5fde84".toLowerCase()}},C=[k.auTokens.AURORA.toLowerCase(),k.auTokens.TRI.toLowerCase(),k.auTokens.PLY.toLowerCase(),k.auTokens.USN.toLowerCase()],B=new Set([].concat(E.auTokens.map((function(e){return e.underlying})),[E.tokens.AURORA,E.tokens.TRI,E.tokens.META,E.tokens.stNEAR,E.tokens.STADER])),S=new t(1),N=["0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f","0x04Ac48711BCdc45b4d223fb021E09DA73c71095e","0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d","0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30","0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79","0xFa94348467f64D5A457F75F8bc40495D33c65aBB"],D=[0],U=r.BigNumber.from(2).pow(256).sub(1),I=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]}))),O={},M=Object.fromEntries([[E.tokens.USN.toLowerCase(),"1"]]),F=Object.fromEntries([["referral-2505",{start:1652882400,end:1653487199}],["referrer-2505",{start:1652882400,end:1653487199}],["referral-0106",{start:1653487200,end:1654091999}],["referrer-0106",{start:1653487200,end:1654091999}],["referral-0806",{start:1654092e3,end:1654696799}],["referrer-0806",{start:1654092e3,end:1654696799}],["referral-1506",{start:1654696800,end:1655301599}],["referrer-1506",{start:1654696800,end:1655301599}]]),W={"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,"0x84b123875f0f36b966d0b6ca14b31121bd9676ad":18,"0x1e0e812fbcd3eb75d8562ad6f310ed94d258d008":18,"0xb39eeb9e168ef6c639f5e282fef1f6bc4dcae375":24,"0x078e103d5f9629ac48b8563fa2bfcd2f6d5fde84":18};function Y(){Y=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",s=a.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 c(e,t,r,a){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),i=new _(a||[]);return n(o,"_invoke",{value:k(e,r,i)}),o}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l={};function f(){}function d(){}function h(){}var m={};u(m,o,(function(){return this}));var w=Object.getPrototypeOf,y=w&&w(w(L([])));y&&y!==t&&r.call(y,o)&&(m=y);var v=h.prototype=f.prototype=Object.create(m);function g(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var a;n(this,"_invoke",{value:function(n,o){function i(){return new t((function(a,i){!function n(a,o,i,s){var u=p(e[a],e,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,i,s)}),(function(e){n("throw",e,i,s)})):t.resolve(l).then((function(e){c.value=e,i(c)}),(function(e){return n("throw",e,i,s)}))}s(u.arg)}(n,o,a,i)}))}return a=a?a.then(i,i):i()}})}function k(e,t,r){var n="suspendedStart";return function(a,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw o;return{value:void 0,done:!0}}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var s=x(i,r);if(s){if(s===l)continue;return s}}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 u=p(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function x(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),l;var a=p(n,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,l;var o=a.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,l):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function A(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 P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function L(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:R}}function R(){return{value:void 0,done:!0}}return d.prototype=h,n(v,"constructor",{value:h,configurable:!0}),n(h,"constructor",{value:d,configurable:!0}),d.displayName=u(h,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,u(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},g(b.prototype),u(b.prototype,i,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,a,o){void 0===o&&(o=Promise);var i=new b(c(t,r,n,a),o);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},g(v),u(v,s,"Generator"),u(v,o,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=L,_.prototype={constructor:_,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(P),!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 a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):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),l},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),P(r),l}},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 a=n.arg;P(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:L(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function j(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function H(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){j(o,n,a,i,s,"next",e)}function s(e){j(o,n,a,i,s,"throw",e)}i(void 0)}))}}function q(){return(q=Object.assign?Object.assign.bind():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 V(e,t){var r,n;e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r=e,n=t,(Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(r,n)}function G(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 K(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 G(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)?G(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 Z=Object.fromEntries(E.auTokens.map((function(e){return[e.address,e.name]})).concat(E.auTokens.map((function(e){return[e.underlying,e.name.slice(2)]}))).concat([["0x04ac48711bcdc45b4d223fb021e09da73c71095e","PULP"]]).map((function(e){var t=e[1];return[e[0].toLowerCase(),t]})));function Q(e,t,r){return X.apply(this,arguments)}function X(){return(X=H(Y().mark((function e(t,r,n){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n&&(n={}),n=q({},n,{module:t,action:r}),e.next=4,A.get("https://explorer.mainnet.aurora.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)}var z="https://explorer.mainnet.aurora.dev/graphiql";function J(e){return $.apply(this,arguments)}function $(){return($=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,A.post(z,{query:t});case 2:return e.abrupt("return",e.sent.data.data);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ee(e,t){if(void 0===t&&(t=""),!e)throw t="Assertion failed"+(t?": "+t:""),new Error(t)}function te(e){return JSON.stringify(e,null," ")}function re(e){return r.BigNumber.from(10).pow(e).toString()}var ne=function(e,t){return e.toLowerCase()==t.toLowerCase()},ae=function(){return Math.trunc(Date.now()/1e3)};function oe(e){return ie.apply(this,arguments)}function ie(){return(ie=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){setTimeout(e,t)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function se(e){try{return r.utils.getAddress(e)}catch(t){throw new Error("Invalid address: "+e)}}function ue(e){var t=e.toLowerCase();return ee(null!=W[t],"Decimal not found for "+e),W[t]}function ce(e){var t=e.toLowerCase();return ee(null!=Z[t],"Symbol not found for "+e),Z[t]}function pe(e){var t=e.toLowerCase(),r=E.auTokens.filter((function(e){return e.address==t}));if(0==r.length)throw new Error("Underlying not found for "+e);return r[0].underlying}function le(e,r,n){return e.isZero()?new t(0):r.lte(0)?e:e.multipliedBy(n).dividedBy(r)}function fe(e,t,r,n){return e.multipliedBy(t).minus(r.multipliedBy(n))}function de(e,t){return he.apply(this,arguments)}function he(){return(he=H(Y().mark((function e(t,r){return Y().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 me(e,t){return we.apply(this,arguments)}function we(){return(we=H(Y().mark((function e(t,r){var n,a,o,i,s;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=200,a=[],o=0;case 3:if(!(o<r.length)){e.next=14;break}return i=r.slice(o,o+n),s=i.map(function(){var e=H(Y().mark((function e(r){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",de(t,r));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.t0=a,e.next=9,Promise.all(s);case 9:e.t1=e.sent,a=e.t0.concat.call(e.t0,e.t1);case 11:o+=n,e.next=3;break;case 14:return e.abrupt("return",a);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ye(e,t){return ve.apply(this,arguments)}function ve(){return(ve=H(Y().mark((function e(t,r){var n,a,o,i,s,u;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!=r.length){e.next=2;break}return e.abrupt("return",[]);case 2:for(n=[],a=r.map((function(e){return"b"+e+": block(number: "+e+") { timestamp }"})),o=0;o<a.length;o+=100)i="{ "+a.slice(o,o+100).join("\n")+" }",n.push(J(i));return e.next=8,Promise.all(n);case 8:return s=e.sent.reduce((function(e,t){return q({},e,t)})),(u=r.filter((function(e){return!s["b"+e]}))).length>0&&u.join(", "),e.next=13,me(t,u);case 13:return e.sent.forEach((function(e,t){s["b"+u[t]]={timestamp:new Date(1e3*e).toISOString()}})),e.abrupt("return",r.map((function(e){return Math.trunc(new Date(s["b"+e].timestamp).getTime()/1e3)})));case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ge(e,t){return be.apply(this,arguments)}function be(){return(be=H(Y().mark((function e(t,r){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Q("block","getblocknobytime",{timestamp:r,closest:"before"});case 2:if(e.t0=parseInt(e.sent.blockNumber),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 ke(e){}function xe(e){return e.sort((function(e,t){return e.blockNumber==t.blockNumber?e.logIndex-t.logIndex:e.blockNumber-t.blockNumber}))}var Ae=function(e){this._networkConnection=e},Pe=function(e){function t(t){if(!(t.signer instanceof P.Signer))throw Error("Signer is not provided when constructing BlockchainEntityReadWrite");return e.call(this,t)||this}return V(t,e),t}(Ae),_e=function(){function e(){}var t=e.prototype;return t.read=function(e){return new Ae(e)},t.readWrite=function(e){return new Pe(e)},e}(),Le=function(e){function t(){var t;return(t=e.apply(this,arguments)||this)._comptroller=null,t._auriFairLaunch=null,t._auriLens=null,t._ply=null,t._pulp=null,t._auriInternalLens=null,t._auriAirdrop=null,t._referralDirectoryV2=null,t._oracle=null,t._plygame=null,t._plyTokenLock=null,t}V(t,e);var n,o,f=t.prototype;return f.getContract=function(e,t){return new r.Contract(e,t,this._networkConnection.provider)},f.getAuTokenContracts=function(){var e=this;return E.auTokens.map((function(t){var r=e.getContract(t.address,p.abi);return r.underlying=t.underlying,r}))},f.getAuErc20Contract=function(e){var t,r=e.address,n=e.underlyingName;return ee(void 0!==r||void 0!==n,"Either address or underlyingName must be provided"),n&&ee(void 0!==(r=null==(t=E.auTokens.find((function(e){return e.name=="au"+n})))?void 0:t.address),"AuToken with underlying "+n+" not found"),this.getContract(r,a.abi)},n=t,(o=[{key:"comptroller",get:function(){return this._comptroller||(this._comptroller=this.getContract(E.misc.COMPTROLLER,l.abi)),this._comptroller}},{key:"auriFairLaunch",get:function(){return this._auriFairLaunch||(this._auriFairLaunch=this.getContract(E.misc.AURIFAIRLAUNCH,s.abi)),this._auriFairLaunch}},{key:"auriLens",get:function(){return this._auriLens||(this._auriLens=this.getContract(E.misc.AURILENS,u.abi)),this._auriLens}},{key:"ply",get:function(){return this._ply||(this._ply=this.getContract(E.tokens.PLY,d.abi)),this._ply}},{key:"pulp",get:function(){return this._pulp||(this._pulp=this.getContract(E.tokens.PULP,y.abi)),this._pulp}},{key:"auriInternalLens",get:function(){return this._auriInternalLens||(this._auriInternalLens=this.getContract(E.misc.AURI_INTERNAL_LENS,h.abi)),this._auriInternalLens}},{key:"auriAirdrop",get:function(){return this._auriAirdrop||(this._auriAirdrop=this.getContract(E.misc.AURI_AIRDROP,i.abi)),this._auriAirdrop}},{key:"referralDirectoryV2",get:function(){return this._referralDirectoryV2||(this._referralDirectoryV2=this.getContract(E.misc.REFERRAL_V2,v.abi)),this._referralDirectoryV2}},{key:"oracle",get:function(){return this._oracle||(this._oracle=this.getContract(E.misc.oracle,c.abi)),this._oracle}},{key:"plygame",get:function(){return this._plygame||(this._plygame=this.getContract(E.misc.PLYGAME,g.abi)),this._plygame}},{key:"plyTokenLock",get:function(){return this._plyTokenLock||(this._plyTokenLock=this.getContract(E.misc.PLY_TOKEN_LOCK,b.abi)),this._plyTokenLock}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,"symbol"==typeof(a=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(n.key))?a:String(a),n)}var a}(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),t}(Ae),Re=function(e,t){this.address=e.toLowerCase(),this.decimals=t},Te=new Re(E.tokens.PLY,ue(E.tokens.PLY)),Ee=new Re(E.tokens.PLYWNEAR,ue(E.tokens.PLYWNEAR)),Ce=function(){function e(e,r,n){void 0===n&&(n=!0),this.rawAmnt=n?r:new t(r).times(re(e.decimals)).toFixed(0),this.token=e}var r=e.prototype;return r.formattedAmount=function(e,r){return void 0!==e&&void 0!==r?new t(this.rawAmnt).div(re(this.token.decimals)).toFormat(e,r):new t(this.rawAmnt).div(re(this.token.decimals)).toString()},r.formattedAmountWithSymbol=function(e,t){return this.formattedAmount(e,t)+" "+ce(this.token.address)},r.rawAmount=function(){return this.rawAmnt},r.compare=function(e){return new t(this.rawAmnt).comparedTo(new t(e.rawAmnt))},e.fromAddressAndAmount=function(t,r,n){return void 0===n&&(n=!0),new e(new Re(t,ue(t)),r,n)},e}(),Be=new Re(E.tokens.WNEAR,24),Se=new Re("0x8729438eb15e2c8b576fcc6aecda6a148776c0f5",18),Ne=new Re("0xE530dC2095Ef5653205CF5ea79F8979a7028065c",18),De=new Ce(Be,"123.456",!1),Ue=new Ce(Be,"0"),Ie=new Ce(Be,"456.123",!1),Oe=new Ce(Be,"1000.123",!1),Me={market:"0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f",depositBalance:Ie,borrowBalance:Ue,isCollateral:!0,maxWithdrawableAmount:De,collateralRatio:.5,underlyingPrice:"1"},Fe={campaign:"testa",startTime:Math.trunc(new Date(2022,8,1).getTime()/1e3),endTime:Math.trunc(new Date(2022,9,30).getTime()/1e3),isReferrer:!1,rewardTokenAmount:De,transactionHash:null,userAddr:"0x...123",refereeAddress:"0x123..123"},We={campaign:"testb",startTime:Math.trunc(new Date(2022,8,1).getTime()/1e3),endTime:Math.trunc(new Date(2022,8,31).getTime()/1e3),isReferrer:!0,rewardTokenAmount:Ie,transactionHash:"0x4da9657663b46ef18d150b897b28c7b717f16421978b52e3a06d91b54ca3548b",userAddr:"0x...456",refereeAddress:"0x123..123"};function Ye(e,t){return je.apply(this,arguments)}function je(){return(je=H(Y().mark((function e(t,r){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===r&&(r={}),e.next=3,A.get("https://api.aurigami.finance/app/"+t+"?"+new URLSearchParams(r),{headers:{"Content-Type":"application/json"}});case 3:return e.abrupt("return",e.sent.data);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function He(e,t,r,n){return qe.apply(this,arguments)}function qe(){return(qe=H(Y().mark((function e(t,r,n,a){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===r&&(r={}),void 0===n&&(n=1),void 0===a&&(a=50),r=q({},r,{page:n,limit:a}),e.next=6,A.get("https://api.aurigami.finance/app/"+t+"?"+new URLSearchParams(r),{headers:{"Content-Type":"application/json"}});case 6:return e.abrupt("return",e.sent.data);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ve(e){return Ge.apply(this,arguments)}function Ge(){return(Ge=H(Y().mark((function e(r){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,A.post("https://coins.llama.fi/prices",{coins:[r]}).then((function(e){return e.data.coins[r].price})).catch((function(e){return console.log("unable to fetch price from DefiLlama API: "+e),console.error(e),0}));case 2:return e.abrupt("return",new t(e.sent));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ke(e){return Ze.apply(this,arguments)}function Ze(){return(Ze=H(Y().mark((function e(r){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,A.get("https://api.coingecko.com/api/v3/simple/price?ids="+r+"&vs_currencies=usd").then((function(e){return e.data[r]})).catch((function(e){return console.log("Unable to fetch price from Coingecko API for "+r),console.error(e),{usd:0}}));case 2:return e.abrupt("return",new t(e.sent.usd));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Qe(e){return Xe.apply(this,arguments)}function Xe(){return(Xe=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.toLowerCase()!=E.tokens.AURORA&&t.toLowerCase()!=E.tokens.TRI&&t.toLowerCase()!=E.tokens.META){e.next=2;break}return e.abrupt("return",Ve("aurora:"+t.toLowerCase()));case 2:throw Error("Unknown token "+t+" in fetchPriceFromDefiLlama");case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ze(e){return Je.apply(this,arguments)}function Je(){return(Je=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t.toLowerCase(),e.next=e.t0===E.tokens.AURORA?3:e.t0===E.tokens.TRI?4:e.t0===E.tokens.META?5:e.t0===E.tokens.STADER?6:7;break;case 3:return e.abrupt("return",Ke("aurora-near"));case 4:return e.abrupt("return",Ke("trisolaris"));case 5:return e.abrupt("return",Ke("meta-pool"));case 6:return e.abrupt("return",Ke("stader"));case 7:throw Error("Unknown token "+t+" in fetchPriceFromCoingecko");case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $e(e,t){return et.apply(this,arguments)}function et(){return(et=H(Y().mark((function e(t,n){var a,o,i;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=new r.Contract(t,m.abi,n),e.next=3,Promise.all([a.token0(),a.token1(),a.getReserves(),a.totalSupply()]);case 3:return e.abrupt("return",{token0:(o=e.sent)[0],token1:o[1],reserve0:(i=o[2]).reserve0,reserve1:i.reserve1,totalSupply:o[3]});case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tt(e,t){return rt.apply(this,arguments)}function rt(){return(rt=H(Y().mark((function e(r,n){var a,o,i,s,u;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=function(){return(s=H(Y().mark((function e(r){var i,s,u;return Y().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,lt(r.address,n);case 4:return i=e.sent,s=ue(r.address),u=i.multipliedBy(r.reserve.toString()).multipliedBy(2),e.abrupt("return",u.multipliedBy(re(o)).dividedBy(new t(a.totalSupply.toString())).dividedBy(re(s)));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)},i=function(e){return s.apply(this,arguments)},e.next=4,$e(r,n);case 4:return a=e.sent,o=ue(r),e.prev=6,e.next=9,i({address:a.token0,reserve:a.reserve0});case 9:if(!(u=e.sent).isZero()){e.next=12;break}throw Error("Price is zero");case 12:return e.abrupt("return",u);case 15:return e.prev=15,e.t0=e.catch(6),e.prev=18,e.next=21,i({address:a.token1,reserve:a.reserve1});case 21:return e.abrupt("return",e.sent);case 24:throw e.prev=24,e.t1=e.catch(18),Error("Unable to fetch price for both tokens of LP "+r);case 28:case"end":return e.stop()}}),e,null,[[6,15],[18,24]])})))).apply(this,arguments)}function nt(){return at.apply(this,arguments)}function at(){return(at=H(Y().mark((function e(){var r,n,a,o,i;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=A.get("https://validators.narwallets.com/metrics_json").then((function(e){return e.data})),n=Ke("near"),e.next=4,Promise.all([r,n]);case 4:return o=(a=e.sent)[1],i=new t(a[0].st_near_price),e.abrupt("return",i.multipliedBy(o));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ot(e,r){return new t(e.toString()).div(re(36-r))}function it(e,t,r){return st.apply(this,arguments)}function st(){return(st=H(Y().mark((function e(t,n,a){var o,i,s;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=new r.Contract(E.misc.oracle,c.abi,a),e.next=3,o.getUnderlyingPrice(t).catch((function(e){return console.log("Unable to fetch price from oracle for "+t),r.BigNumber.from(0)}));case 3:if(!(i=e.sent).isZero()){e.next=8;break}if("auSTNEAR"!=(null==(s=E.auTokens.find((function(e){return ne(e.address,t)})))?void 0:s.name)){e.next=8;break}return e.abrupt("return",nt());case 8:return e.abrupt("return",ot(i,n));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ut(e){return ct.apply(this,arguments)}function ct(){return(ct=H(Y().mark((function e(t){var n,a,o;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new r.Contract(E.misc.AURILENS,u.abi,t),a=E.auTokens.map((function(e){return e.address})),o=E.auTokens.map((function(e){return ue(e.underlying)})),e.next=5,n.auTokenUnderlyingPriceAll(a);case 5:return e.abrupt("return",e.sent.map((function(e,t){return{auToken:e.auToken,underlyingPrice:ot(e.underlyingPrice,o[t])}})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pt(e){return(e=e.toLowerCase())==E.tokens.AURORA||e==E.tokens.TRI||e==E.tokens.META||e==E.tokens.STADER}function lt(e,t){return ft.apply(this,arguments)}function ft(){return(ft=H(Y().mark((function e(t,r){var n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ee(B.has(t.toLocaleLowerCase()),"Address "+t+" is not whitelisted for price fetching"),!pt(t)){e.next=11;break}return e.prev=2,e.next=5,ze(t);case 5:return e.abrupt("return",e.sent);case 8:return e.prev=8,e.t0=e.catch(2),e.abrupt("return",Qe(t));case 11:if(void 0===(n=E.auTokens.find((function(e){return ne(e.underlying,t)})))){e.next=16;break}return e.abrupt("return",it(n.address,ue(t),r));case 16:throw Error("Unable to fetch price for "+t);case 17:case"end":return e.stop()}}),e,null,[[2,8]])})))).apply(this,arguments)}function dt(e,t){return ht.apply(this,arguments)}function ht(){return(ht=H(Y().mark((function e(r,n){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.toLowerCase()in M)){e.next=4;break}return e.abrupt("return",new t(M[r.toLowerCase()]));case 4:if(!ne(r,E.tokens.PLYWNEAR)){e.next=8;break}return e.abrupt("return",tt(r,n));case 8:if(!ne(r,E.tokens.PLY)){e.next=12;break}return e.abrupt("return",mt(n));case 12:if(!ne(r,E.tokens.PULP)){e.next=14;break}return e.abrupt("return",yt(n));case 14:return e.abrupt("return",lt(r,n));case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mt(e){return wt.apply(this,arguments)}function wt(){return(wt=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gt(E.tokens.PLYWNEAR,t));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function yt(e){return vt.apply(this,arguments)}function vt(){return(vt=H(Y().mark((function e(r){return Y().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 gt(e,t){return bt.apply(this,arguments)}function bt(){return(bt=H(Y().mark((function e(r,n){var a,o,i;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,$e(r,n);case 2:if(!(a=e.sent).reserve1.isZero()){e.next=5;break}return e.abrupt("return",new t(0));case 5:return o=ue(a.token0),i=ue(a.token1),e.next=9,dt(a.token1,n);case 9:return e.abrupt("return",e.sent.multipliedBy(a.reserve1.toString()).multipliedBy(re(o)).dividedBy(re(i)).dividedBy(a.reserve0.toString()));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kt(e,t){return xt.apply(this,arguments)}function xt(){return(xt=H(Y().mark((function e(r,n){return Y().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,dt(r.token.address,n);case 4:return e.abrupt("return",At(r,e.sent));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function At(e,r){return new t(e.formattedAmount()).multipliedBy(r)}function Pt(e,t){return _t.apply(this,arguments)}function _t(){return(_t=H(Y().mark((function e(t,r){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,kt(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 Lt=function(e){function t(t,n){var a;return(a=e.call(this,n)||this).auToken=new r.Contract(t,p.abi,a._networkConnection.provider),a}V(t,e);var n=t.prototype;return n.queryERC20TransfersOf=function(){var e=H(Y().mark((function e(t,r,n){var a,o,i,s=this;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=[this.auToken.filters.Transfer(t,null),this.auToken.filters.Transfer(null,t)],e.next=3,Promise.all(a.map((function(e){return s.auToken.queryFilter(e,r,n)})));case 3:return o=e.sent.flat(),(i=o.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=H(Y().mark((function e(t,r){return Y().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}(Ae);function Rt(e,t,r){return Tt.apply(this,arguments)}function Tt(){return(Tt=H(Y().mark((function e(t,n,a){var o,i,s;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=new r.Contract(t,m.abi,n),(i=[]).push(o.token0()),i.push(o.token1()),i.push(o.getReserves({blockTag:a})),i.push(o.totalSupply({blockTag:a})),e.next=8,Promise.all(i);case 8:return e.abrupt("return",{token0:(s=e.sent)[0],token1:s[1],reserve0:s[2].reserve0,reserve1:s[2].reserve1,totalSupply:s[3]});case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Et(e,t,r){return Ct.apply(this,arguments)}function Ct(){return(Ct=H(Y().mark((function e(r,n,a){var o,i,s,u,c;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=function(){return(u=H(Y().mark((function e(r,a){var s,u,c;return Y().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,Dt(r.address,n,a);case 4:return s=e.sent,u=ue(r.address),c=s.multipliedBy(r.reserve.toString()).multipliedBy(2),e.abrupt("return",c.multipliedBy(re(i)).dividedBy(new t(o.totalSupply.toString())).dividedBy(re(u)));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)},s=function(e,t){return u.apply(this,arguments)},e.next=4,Rt(r,n,a);case 4:return o=e.sent,i=ue(r),e.prev=6,e.next=9,s({address:o.token0,reserve:o.reserve0},a);case 9:if(!(c=e.sent).isZero()){e.next=12;break}throw Error("Price is zero");case 12:return e.abrupt("return",c);case 15:return e.prev=15,e.t0=e.catch(6),e.prev=18,e.next=21,s({address:o.token1,reserve:o.reserve1},a);case 21:return e.abrupt("return",e.sent);case 24:throw e.prev=24,e.t1=e.catch(18),Error("Unable to fetch price for both tokens of LP "+r);case 28:case"end":return e.stop()}}),e,null,[[6,15],[18,24]])})))).apply(this,arguments)}function Bt(e,r){return new t(e.toString()).div(re(36-r))}function St(e,t,r,n){return Nt.apply(this,arguments)}function Nt(){return(Nt=H(Y().mark((function e(t,n,a,o){var i;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=new r.Contract(E.misc.oracle,c.abi,a),e.next=3,i.getUnderlyingPrice(t,{blockTag:o}).catch((function(e){return console.log("Unable to fetch price from oracle for "+t),r.BigNumber.from(0)}));case 3:return e.abrupt("return",Bt(e.sent,n));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Dt(e,t,r){return Ut.apply(this,arguments)}function Ut(){return(Ut=H(Y().mark((function e(r,n,a){var o;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.toLowerCase()in M)){e.next=4;break}return e.abrupt("return",new t(M[r.toLowerCase()]));case 4:if(!(ne(r,E.tokens.PLY_WNEAR)||ne(r,E.tokens.WNEAR_TRI)||ne(r,E.tokens.AURORA_WNEAR))){e.next=8;break}return e.abrupt("return",Et(r,n,a));case 8:if(!ne(r,E.tokens.PLY)){e.next=12;break}return e.abrupt("return",Mt(E.tokens.PLY_WNEAR,n,a));case 12:if(!ne(r,E.tokens.TRI)){e.next=16;break}return e.abrupt("return",Mt(E.tokens.WNEAR_TRI,n,a,1));case 16:if(!ne(r,E.tokens.AURORA)){e.next=18;break}return e.abrupt("return",Mt(E.tokens.AURORA_WNEAR,n,a));case 18:if(void 0===(o=E.auTokens.find((function(e){return ne(e.underlying,r)})))){e.next=23;break}return e.abrupt("return",St(o.address,ue(r),n,a));case 23:throw Error("Unable to fetch price for "+r);case 24:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function It(e){return Ot.apply(this,arguments)}function Ot(){return(Ot=H(Y().mark((function e(r){return Y().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 Mt(e,t,r,n){return Ft.apply(this,arguments)}function Ft(){return(Ft=H(Y().mark((function e(r,n,a,o){var i,s,u;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===o&&(o=0),e.next=3,Rt(r,n,a);case 3:if(i=e.sent,1===o&&(i={token0:i.token1,token1:i.token0,reserve0:i.reserve1,reserve1:i.reserve0,totalSupply:i.totalSupply}),!i.reserve1.isZero()){e.next=7;break}return e.abrupt("return",new t(0));case 7:return s=ue(i.token0),u=ue(i.token1),e.next=11,Dt(i.token1,n,a);case 11:return e.abrupt("return",e.sent.multipliedBy(i.reserve1.toString()).multipliedBy(re(s)).dividedBy(re(u)).dividedBy(i.reserve0.toString()));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Wt={__proto__:null,getApi:Ye,getPaginatedApi:He,getQuery:Q,queryGraphQL:J,assert:ee,formatObject:te,decimalFactor:re,isSameAddress:ne,getCurrentTimestamp:ae,sleep:oe,validateAndParseAddress:se,getDecimal:ue,getSymbol:ce,getUnderlying:pe,calcLMRewardApr:le,calcNetApy:fe,getBlockTimestamp:de,getBlocksTimestampViaRPC:me,getBlocksTimestamp:ye,getBlockBeforeTimestamp:ge,devLog:ke,sortEvents:xe,fetchPriceFromDefiLlamaAPI:Ve,fetchPriceFromCoingeckoAPI:Ke,fetchPriceFromDefiLlama:Qe,fetchPriceFromCoingecko:ze,fetchLPPositions:$e,fetchLPPrice:tt,fetchStNEARPrice:nt,fetchPriceFromOracle:it,fetchUnderlyingTokensPrices:ut,fetchPrice:dt,fetchPLYPrice:mt,fetchPULPPrice:yt,fetchToken0PriceByLP:gt,fetchValuation:kt,calcValuation:At,valuateToken:Pt,TransferEventQuery:Lt,fetchHistoricalLPPositions:Rt,fetchHistoricalLPPrice:Et,fetchHistoricalPriceFromOracle:St,fetchHistoricalPrice:Dt,fetchHistoricalPULPPrice:It,fetchHistoricalPriceByLP:Mt},Yt=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new Le(t),r}return V(t,e),t.prototype.getRedeemableReward=function(){var e=H(Y().mark((function e(t,n,a){var o;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=new Re(n,ue(n)),e.next=3,this.env.auriAirdrop.getRedeemableReward(r.utils.formatBytes32String(t),n,a);case 3:return e.abrupt("return",new Ce(o,e.sent.toString()));case 5:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),t}(Ae),jt=function(e){function t(){return e.apply(this,arguments)||this}V(t,e);var n=t.prototype;return n.redeemMultiple=function(){var e=H(Y().mark((function e(t,n){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ee(t.length==n.length,"campaigns and tokens must have the same length"),e.t0=this.env.auriAirdrop.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=H(Y().mark((function e(t,r){return Y().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}(Yt),Ht=function(e){function t(){return e.call(this)||this}V(t,e);var r=t.prototype;return r.read=function(e){return new Yt(e)},r.readWrite=function(e){return new jt(e)},t}(_e),qt=function(e){function n(t,n,i){var s;return(s=e.call(this,t)||this).env=new Le(t),s.auToken=ne(i,T)?new r.Contract(n,o.abi,t.provider):new r.Contract(n,a.abi,t.provider),s.underlying=new Re(i,ue(i)),s}V(n,e);var i=n.prototype;return i.getUnderlyingPrice=function(){var e=H(Y().mark((function e(){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",dt(this.underlying.address,this._networkConnection.provider));case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getPlyPrice=function(){var e=H(Y().mark((function e(){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",dt(E.tokens.PLY,this._networkConnection.provider));case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getRewardSpeeds=function(){var e=H(Y().mark((function e(){return Y().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)}}(),i.getTotalTokenBorrowed=function(){var e=H(Y().mark((function e(){return Y().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)}}(),i.getTotalTokenDeposited=function(){var e=H(Y().mark((function e(){var t,n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getTotalTokenBorrowed(),this.auToken.getCash()]);case 2:return n=(t=e.sent)[0],e.abrupt("return",new Ce(this.underlying,r.BigNumber.from(new Ce(this.underlying,t[1].toString()).rawAmount()).add(n.rawAmount()).toString()));case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getDepositAPY=function(){var e=H(Y().mark((function e(){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.auToken.supplyRatePerTimestamp();case 2:return r=new t(e.sent.toString()).multipliedBy(86400).div(re(18)),e.abrupt("return",new t(r.plus(1)).pow(365).minus(1));case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getBorrowAPY=function(){var e=H(Y().mark((function e(){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.auToken.borrowRatePerTimestamp();case 2:return r=new t(e.sent.toString()).multipliedBy(86400).div(re(18)),e.abrupt("return",new t(r.plus(1)).pow(365).minus(1));case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getCollateralRatio=function(){var e=H(Y().mark((function e(){return Y().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(re(18))})));case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getBorrowPlyAPY=function(){var e=H(Y().mark((function e(){var t,r,n,a;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getTotalTokenBorrowed(),this.getRewardSpeeds(),this.getPlyPrice(),this.getUnderlyingPrice()]);case 2:return r=(t=e.sent)[0],n=t[2],a=t[3],e.abrupt("return",le(At(new Ce(Te,t[1].plyRewardBorrowSpeed.toString()),n),a.multipliedBy(r.formattedAmount()),31536e3));case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getDepositPlyAPY=function(){var e=H(Y().mark((function e(){var t,r,n,a;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getTotalTokenDeposited(),this.getRewardSpeeds(),this.getPlyPrice(),this.getUnderlyingPrice()]);case 2:return r=(t=e.sent)[0],n=t[2],a=t[3],e.abrupt("return",le(At(new Ce(Te,t[1].plyRewardSupplySpeed.toString()),n),a.multipliedBy(r.formattedAmount()),31536e3));case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getDepositNearAPY=function(){var e=H(Y().mark((function e(){var t,r,n,a;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getTotalTokenDeposited(),this.getUnderlyingPrice()]);case 2:return r=(t=e.sent)[0],n=t[1],e.t0=Wt,e.next=8,kt(this.getDepositNEARRewardPerWeek(),this._networkConnection.provider);case 8:return e.t1=e.sent,e.t2=n.multipliedBy(r.formattedAmount()),a=e.t0.calcLMRewardApr.call(e.t0,e.t1,e.t2,52),e.abrupt("return",a);case 12:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getBorrowNearAPY=function(){var e=H(Y().mark((function e(){var t,r,n,a;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getTotalTokenBorrowed(),this.getUnderlyingPrice()]);case 2:return r=(t=e.sent)[0],n=t[1],e.t0=Wt,e.next=8,kt(this.getBorrowNEARRewardPerWeek(),this._networkConnection.provider);case 8:return e.t1=e.sent,e.t2=n.multipliedBy(r.formattedAmount()),a=e.t0.calcLMRewardApr.call(e.t0,e.t1,e.t2,52),e.abrupt("return",a);case 12:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getDepositMetaAPY=function(){var e=H(Y().mark((function e(){var r,n,a,o;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getTotalTokenDeposited(),dt(this.underlying.address,this._networkConnection.provider)]);case 2:if(n=(r=e.sent)[0],a=r[1],!ne(this.underlying.address,E.tokens.stNEAR)){e.next=14;break}return e.t0=Wt,e.next=9,kt(Ce.fromAddressAndAmount(E.tokens.META,"750000",!1),this._networkConnection.provider);case 9:e.t1=e.sent,e.t2=a.multipliedBy(n.formattedAmount()),o=e.t0.calcLMRewardApr.call(e.t0,e.t1,e.t2,12),e.next=15;break;case 14:o=new t(0);case 15:return e.abrupt("return",o);case 16:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getDepositStaderAPY=function(){var e=H(Y().mark((function e(){var r,n,a,o;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(ae()<1675346400)){e.next=4;break}return e.abrupt("return",new t(0));case 4:return e.next=6,Promise.all([this.getTotalTokenDeposited(),dt(this.underlying.address,this._networkConnection.provider)]);case 6:if(n=(r=e.sent)[0],a=r[1],!ne(this.underlying.address,E.tokens.NEARX)){e.next=18;break}return e.t0=Wt,e.next=13,kt(Ce.fromAddressAndAmount(E.tokens.STADER,"81",!1),this._networkConnection.provider);case 13:e.t1=e.sent,e.t2=a.multipliedBy(n.formattedAmount()),o=e.t0.calcLMRewardApr.call(e.t0,e.t1,e.t2,365),e.next=19;break;case 18:o=new t(0);case 19:return e.abrupt("return",o);case 20:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getDetails=function(){var e=H(Y().mark((function e(){var t,r,n,a,o,i,s,u,c,p,l,f,d,h;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getTotalTokenDeposited(),this.getTotalTokenBorrowed(),this.getDepositAPY(),this.getBorrowAPY(),this.getCollateralRatio(),this.getRewardSpeeds()]);case 2:return r=(t=e.sent)[0],n=t[1],a=t[2],o=t[3],i=t[4],s=t[5],e.next=11,Promise.all([this.getDepositPlyAPY(),this.getBorrowPlyAPY(),this.getDepositNearAPY(),this.getBorrowNearAPY(),this.getDepositMetaAPY(),this.getDepositStaderAPY()]);case 11:return c=(u=e.sent)[0],p=u[1],l=u[2],f=u[3],d=u[4],h=u[5],e.abrupt("return",{auTokenAddress:this.auToken.address,totalTokenDeposited:r,totalTokenBorrowed:n,depositApy:a.toNumber(),depositPlyApy:c.toNumber(),borrowApy:o.toNumber(),borrowPlyApy:-1*p.toNumber(),collateralRatio:i.toNumber(),depositPlyPerWeek:new Ce(Te,s.plyRewardSupplySpeed.mul(86400).mul(7).toString()),borrowPlyPerWeek:new Ce(Te,s.plyRewardBorrowSpeed.mul(86400).mul(7).toString()),depositNEARApy:l.toNumber(),borrowNEARApy:-1*f.toNumber(),depositMETAApy:d.toNumber(),staderDepositApy:h.toNumber()});case 19:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),i.getUserBorrowBalance=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),i.getUserDepositBalance=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),i.getDepositNEARRewardPerWeek=function(){var e=new Re(E.tokens.WNEAR,ue(E.tokens.WNEAR)),t=ae();if(t<=1651845600&&t>1650636e3){var r,n=null!=(r=I[this.underlying.address.toLocaleLowerCase()])?r:"0";return new Ce(e,n,!1)}return new Ce(e,"0")},i.getBorrowNEARRewardPerWeek=function(){var e=new Re(E.tokens.WNEAR,ue(E.tokens.WNEAR)),t=ae();if(t<=1651845600&&t>1650636e3){var r,n=null!=(r=O[this.underlying.address.toLocaleLowerCase()])?r:"0";return new Ce(e,n,!1)}return new Ce(e,"0")},i.mintCap=function(){var e=H(Y().mark((function e(){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Ce,e.t1=this.underlying,e.next=4,this.env.comptroller.mintCaps(this.auToken.address);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)}}(),i.borrowCap=function(){var e=H(Y().mark((function e(){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Ce,e.t1=this.underlying,e.next=4,this.env.comptroller.borrowCaps(this.auToken.address);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)}}(),i.getApyWithoutIncentive=function(){var e=H(Y().mark((function e(t){var r,n,a,o,i,s,u,c;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getUnderlyingPrice(),this.getDepositAPY(),this.getBorrowAPY(),this.getUserDepositBalance(t),this.getUserBorrowBalance(t)]);case 2:return a=(r=e.sent)[1],o=r[2],i=r[4],s=(n=r[0]).multipliedBy(r[3].formattedAmount()),u=n.multipliedBy(i.formattedAmount()),c=fe(s,a,u,o),e.abrupt("return",{sum:c,suppliedValue:s,borrowedValue:u});case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),i.getApyWithIncentive=function(){var e=H(Y().mark((function e(t){var r,n,a,o,i,s,u,c,p,l,f,d,h,m,w,y,v;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this.getUnderlyingPrice(),this.getDepositAPY(),this.getBorrowAPY(),this.getUserDepositBalance(t),this.getUserBorrowBalance(t),this.getDepositNearAPY(),this.getDepositPlyAPY(),this.getDepositMetaAPY(),this.getBorrowNearAPY(),this.getBorrowPlyAPY()]);case 2:return n=(r=e.sent)[0],a=r[1],o=r[2],i=r[3],s=r[4],u=r[5],c=r[6],p=r[7],l=r[8],f=r[9],e.next=15,this.getDepositStaderAPY();case 15:return d=e.sent,h=n.multipliedBy(i.formattedAmount()),m=n.multipliedBy(s.formattedAmount()),w=a.plus(u).plus(c).plus(p).plus(d),y=o.plus(l).plus(f),v=fe(h,w,m,y),e.abrupt("return",{sum:v,suppliedValue:h,borrowedValue:m});case 22:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n}(Ae);_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getUnderlyingPrice",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getPlyPrice",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getRewardSpeeds",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getTotalTokenBorrowed",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getTotalTokenDeposited",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getDepositAPY",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getBorrowAPY",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getCollateralRatio",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getBorrowPlyAPY",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getDepositPlyAPY",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getDepositNearAPY",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getBorrowNearAPY",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getDepositMetaAPY",null),_.__decorate([L.cache({ttl:1e4,type:L.CacheType.MEMO}),_.__metadata("design:type",Function),_.__metadata("design:paramtypes",[]),_.__metadata("design:returntype",Promise)],qt.prototype,"getDepositStaderAPY",null);var Vt,Gt,Kt=function(e){function n(t,n,a){var o;return(o=e.call(this,t,n,a)||this)._EthRepayHelper=new r.Contract(E.misc.ETHREPAYHELPER,f.abi,t.provider),o}V(n,e);var a=n.prototype;return a.deposit=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!ne(t.token.address,T)){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)}}(),a.borrow=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),a.withdraw=function(){var e=H(Y().mark((function e(r){return Y().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(U));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)}}(),a.repay=function(){var e=H(Y().mark((function e(r){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!ne(r.token.address,T)){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(U));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)}}(),a.enableCollateral=function(){var e=H(Y().mark((function e(){return Y().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)}}(),a.disableCollateral=function(){var e=H(Y().mark((function e(){return Y().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}(qt),Zt=function(e){function t(t,r){var n;return(n=e.call(this)||this).address=se(t),n.underlying=se(r),n}V(t,e);var r=t.prototype;return r.read=function(e){return new qt(e,this.address,this.underlying)},r.readWrite=function(e){return new Kt(e,this.address,this.underlying)},t}(_e),Qt=r.BigNumber.from(1e4),Xt=function(e){function n(t){var r;(r=e.call(this,t)||this).env=new Le(t);var n=E.tokens.PLY,a=E.tokens.PULP;return r.plyToken=new Re(n,ue(n)),r.pulpToken=new Re(a,ue(a)),r}V(n,e);var a=n.prototype;return a.getPlyBalance=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),a.getPulpBalance=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),a.getUnclaimedPlyReward=function(){var e=H(Y().mark((function e(t){return Y().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,D,{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)}}(),a.getWeek=function(e){return r.BigNumber.from(e-1651759200).div(604800).toNumber()},a.getLockingDetails=function(){var e=H(Y().mark((function e(n){var a,o,i,s,u,c,p,l,f,d,h,m;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=this.getWeek(ae()),e.next=3,Promise.all([this.env.auriLens.getPercentLock(this.env.pulp.address,n,a),this.env.auriLens.getPercentLock(this.env.pulp.address,n,a+1),this.getUnclaimedPlyReward(n)]);case 3:return i=r.BigNumber.from((o=e.sent)[0]),s=r.BigNumber.from(o[1]),u=o[2],e.next=9,this.env.pulp.calcLockAmount(n,u.rawAmount());case 9:return p=(c=e.sent)[0],l=c[1],f=s.mul(u.rawAmount()).div(Qt),d=r.BigNumber.from(u.rawAmount()).sub(f),h=Qt.sub(i).toString(),m=Qt.sub(s).toString(),e.abrupt("return",{vestingStart:1651759200,currentUnlockPortion:new t(h).dividedBy(100).toNumber(),accruedPly:u,currentPly:new Ce(this.plyToken,l.toString()),currentPulp:new Ce(this.pulpToken,p.toString()),nextUnlockPortion:new t(m).dividedBy(100).toNumber(),nextPly:new Ce(this.plyToken,f.toString()),nextPulp:new Ce(this.pulpToken,d.toString())});case 17:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),a.getTimestampToUnlock=function(){var e=H(Y().mark((function e(t,r){return Y().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)}}(),a.getNextWeekTimestamp=function(){return 1651759200+604800*(this.getWeek(ae())+1)},a.getUnlockPortionAt=function(){var e=H(Y().mark((function e(t,r){var n;return Y().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=Qt.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}(Ae),zt=function(e){function t(t){return e.call(this,t)||this}V(t,e);var r=t.prototype;return r.redeem=function(){var e=H(Y().mark((function e(t,r){return Y().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=H(Y().mark((function e(t){return Y().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}(Xt),Jt=function(e){function t(){return e.call(this)||this}V(t,e);var r=t.prototype;return r.read=function(e){return new Xt(e)},r.readWrite=function(e){return new zt(e)},t}(_e),$t=function(e){function t(t){var r;(r=e.call(this,t)||this).env=new Le(t);var n=E.tokens.PLY,a=E.tokens.PULP;return r.plyToken=new Re(n,ue(n)),r.pulpToken=new Re(a,ue(a)),r}V(t,e);var n=t.prototype;return n.parseBetMakeEvent=function(e){var t=["bigWin","win","lose","noImpact"][e.args.outcome],r=e.args.amount,n=r.mul([0,0,100,2][e.args.outcome]).div(100),a=r.mul([10,1,0,0][e.args.outcome]);return{player:e.args.player,lostAmount:new Ce(this.plyToken,n.toString()),unlockedPulpAmount:new Ce(this.pulpToken,a.toString()),outcome:t,transactionHash:e.transactionHash,block:e.blockNumber,timestamp:0}},n.attachTimestamp=function(){var e=H(Y().mark((function e(t){var r,n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.map((function(e){return e.block})),e.next=3,ye(this._networkConnection.provider,r);case 3:return n=e.sent,e.abrupt("return",t.map((function(e,t){return q({},e,{timestamp:n[t]})})));case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.getUserPlyGameHistory=function(){var e=H(Y().mark((function e(t){var r,n,a,o=this;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.plygame.getLastBlock(t,100);case 2:if(!(r=e.sent).eq(0)){e.next=5;break}return e.abrupt("return",[]);case 5:return n=this.env.plygame.filters.BetMade(t),e.next=8,this.env.plygame.queryFilter(n,r.toNumber());case 8:return xe(a=e.sent).reverse(),e.abrupt("return",this.attachTimestamp(a.map((function(e){return o.parseBetMakeEvent(e)}))));case 11:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.currentJackpotAmount=function(){var e=H(Y().mark((function e(){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.plygame.currentJackpotAmount();case 2:return e.abrupt("return",new Ce(this.plyToken,e.sent.toString()));case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),n.earlyUnlockedPulpAmount=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.plygame.totalPlyUnlockedEarly(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)}}(),n.getPlyGameResultsInTransaction=function(){var e=H(Y().mark((function e(t){var r,n,a,o,i=this;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._networkConnection.provider.getTransactionReceipt(t);case 2:r=e.sent,n=0;case 4:if(!(n<100)||r){e.next=13;break}return e.next=7,oe(1e3);case 7:return e.next=9,this._networkConnection.provider.getTransactionReceipt(t);case 9:r=e.sent;case 10:n++,e.next=4;break;case 13:if(r){e.next=15;break}throw new Error("Transaction "+t+" takes too long to be mined");case 15:return a=this.env.plygame.filters.BetMade(),o=r.logs.filter((function(e){return ne(e.topics[0],a.topics[0])})).map((function(e){return q({},i.env.plygame.interface.parseLog(e),{blockNumber:r.blockNumber,transactionHash:t})})),e.abrupt("return",this.attachTimestamp(o.map((function(e){return i.parseBetMakeEvent(e)}))));case 18:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.leaderboard=function(){var e=H(Y().mark((function e(){var t=this;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,He("/plygame/leaderboard");case 2:return e.abrupt("return",e.sent.items.map((function(e,r){return{player:e.user,unlockedPulpAmount:new Ce(t.pulpToken,e.unlockedAmount),gamesPlayed:e.count}})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),n.getLastJackpotResult=function(){var e=H(Y().mark((function e(){var t,n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=r.BigNumber,e.next=3,this._networkConnection.provider.getStorageAt(this.env.plygame.address,158);case 3:return e.t1=e.sent,t=e.t0.from.call(e.t0,e.t1),e.next=7,this.env.plygame.jackpotHistory(t.sub(1));case 7:return e.abrupt("return",{winner:(n=e.sent).winner.slice(0,5)+"..."+n.winner.slice(-3),amount:new Ce(this.plyToken,n.amount.toString())});case 9:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),n.overallLeaderboard=function(){var e=H(Y().mark((function e(){var t=this;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,He("/plygame/overallLeaderboard");case 2:return e.abrupt("return",e.sent.items.map((function(e){return{player:e.user,unlockedPulpAmount:new Ce(t.pulpToken,e.unlockedAmount),gamesPlayed:e.count}})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),t}(Ae),er=function(e){function t(){return e.apply(this,arguments)||this}V(t,e);var r=t.prototype;return r.makeBetOnce=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.plygame.connect(this._networkConnection.signer).makeBetOnce(t.rawAmount()));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),r.approve=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.ply.connect(this._networkConnection.signer).approve(this.env.plygame.address,t.rawAmount()));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}($t),tr=function(e){function t(){return e.call(this)||this}V(t,e);var r=t.prototype;return r.read=function(e){return new $t(e)},r.readWrite=function(e){return new er(e)},t}(_e),rr=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new Le(t),r}return V(t,e),t.prototype.remainingEarlyUnlockPulp=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.pulp.earlyRedeems(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(Ae),nr=function(e){function t(){return e.apply(this,arguments)||this}return V(t,e),t.prototype.convertEarlyPulp=function(){var e=H(Y().mark((function e(t,n){var a;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=r.BigNumber.from(n.rawAmount()),e.abrupt("return",this.env.pulp.connect(this._networkConnection.signer).redeem(t,a));case 2:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t}(rr),ar=function(e){function t(){return e.call(this)||this}V(t,e);var r=t.prototype;return r.read=function(e){return new rr(e)},r.readWrite=function(e){return new nr(e)},t}(_e),or=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new Le(t),r}V(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=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.referralDirectoryV2.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=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.referralDirectoryV2.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=H(Y().mark((function e(t){var n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.ethers.utils.formatBytes32String(t),e.abrupt("return",this.env.referralDirectoryV2.referralCodeOwner(n));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.getReferralsList=function(){var e=H(Y().mark((function e(t){var r,n,a,o;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,He("/referral/list",{address:t});case 2:return n=(r=e.sent).items.map((function(e){return e.blockNumber})),e.next=6,ye(this._networkConnection.provider,n);case 6:return a=e.sent,o=r.items.map((function(e,t){return{user:e.user,timestamp:a[t]}})),e.abrupt("return",o);case 9:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.referralRewards=function(){var e=H(Y().mark((function e(t){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,He("/referral/rewards",{address:t});case 2:return r=e.sent.items.map((function(e,r){var n;return{campaign:e.campaign,userAddr:t,isReferrer:e.campaign.includes("referrer"),rewardTokenAmount:Ce.fromAddressAndAmount(e.token,e.amount),startTime:F[e.campaign].start,endTime:F[e.campaign].end,transactionHash:null!=(n=e.transactionHash)?n:null,refereeAddress:null}})),e.abrupt("return",r);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.leaderboard=function(){var e=H(Y().mark((function e(t){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,He("/referral/leaderboard",{campaign:t});case 2:return(r=e.sent.items.map((function(e,r){return{campaign:t,userAddr:e.user,isReferrer:e.campaign.includes("referrer"),rewardTokenAmount:Ce.fromAddressAndAmount(e.token,e.amount),startTime:F[e.campaign].start,endTime:F[e.campaign].end,transactionHash:null,refereeAddress:null}}))).sort((function(e,t){return t.rewardTokenAmount.compare(e.rewardTokenAmount)})),e.abrupt("return",r);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.slotsInUse=function(){var e=H(Y().mark((function e(){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ye("/referral/slotsInUse");case 2:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),n.totalReferralSlots=function(){return 500},n.queuePosition=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ye("/referral/queuePosition",{address:t});case 2:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.userReferralStatus=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ye("/referral/referralStatus",{address:t});case 2:e.t0=e.sent,e.next=-1===e.t0?6:0===e.t0?7:1===e.t0?8:9;break;case 6:return e.abrupt("return","notReferred");case 7:return e.abrupt("return","notQualified");case 8:return e.abrupt("return","Qualified");case 9:return e.abrupt("return","Withdrawn");case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.isWhitelistedAddress=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.referralDirectoryV2.isUserWhitelisted(t);case 2:return e.abrupt("return",e.sent.eq(1));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.isOnAuroraPlus=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,A.get("https://aurora.plus/api/wallet/"+t);case 2:return e.abrupt("return","active"==e.sent.data.status);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.isNewUserAtReferralTime=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ye("/referral/isNewUser",{address:t});case 2:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.depositedMoreThanMinimumAmount=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ye("/referral/depositedEnough",{address:t});case 2:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t}(Ae),ir=function(e){function t(){return e.apply(this,arguments)||this}V(t,e);var n=t.prototype;return n.registerNewReferralCode=function(){var e=H(Y().mark((function e(){var t;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.ethers.utils.formatBytes32String(this.generateReferralCode()),e.abrupt("return",this.env.referralDirectoryV2.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=H(Y().mark((function e(t){var n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.ethers.utils.formatBytes32String(t),e.abrupt("return",this.env.referralDirectoryV2.connect(this._networkConnection.signer).registerReferralCodeUsed(n));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.claimReferralRewards=function(){var e=H(Y().mark((function e(){var t,r,n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=this,e.next=3,this._networkConnection.signer.getAddress();case 3:return e.t1=e.sent,e.next=6,e.t0.referralRewards.call(e.t0,e.t1);case 6:return t=e.sent.filter((function(e){return null==e.transactionHash})),r=t.map((function(e){return e.campaign})),n=t.map((function(e){return e.rewardTokenAmount.token.address})),e.abrupt("return",new jt(this._networkConnection).redeemMultiple(r,n));case 10:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t}(or),sr=function(e){function t(){return e.call(this)||this}V(t,e);var r=t.prototype;return r.read=function(e){return new or(e)},r.readWrite=function(e){return new ir(e)},t}(_e),ur=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new Le(t),r}V(t,e);var n=t.prototype;return n.getPLYWNEARPoolDetails=function(){var e=H(Y().mark((function e(){var t,r,n,a,o,i,s,u,c;return Y().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(Ee,t.toString()),e.next=5,kt(n,this._networkConnection.provider);case 5:for(a=e.sent,o=[],i=0;i<r.length;i++)u=new Re(s=N[i],ue(s)),o.push(kt(new Ce(u,r[i].toString()),this._networkConnection.provider));return c=[],e.next=11,Promise.all(o);case 11:return e.sent.forEach((function(e,t){var r=N[t],n=le(e,a,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=H(Y().mark((function e(t){return Y().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(Ee,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=H(Y().mark((function e(t){var n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new r.Contract(E.tokens.PLYWNEAR,d.abi,this._networkConnection.provider),e.next=3,n.balanceOf(t);case 3:return e.abrupt("return",new Ce(Ee,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=H(Y().mark((function e(t){return Y().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(N[t],e.toString())})));case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(Ae),cr=function(e){function t(){return e.apply(this,arguments)||this}V(t,e);var n=t.prototype;return n.stake=function(){var e=H(Y().mark((function e(t){return Y().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=H(Y().mark((function e(t){var n,a,o,i;return Y().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,a=r.BigNumber.from(t.rawAmount()),e.t0=r.BigNumber,e.next=7,this.stakeBalanceOf(n);case 7:return e.t1=e.sent.rawAmount(),o=e.t0.from.call(e.t0,e.t1),i=a.lt(o)?a:o.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}(ur),pr=function(e){function t(){return e.call(this)||this}V(t,e);var r=t.prototype;return r.read=function(e){return new ur(e)},r.readWrite=function(e){return new cr(e)},t}(_e);(Vt=exports.ComptrollerRewardType||(exports.ComptrollerRewardType={}))[Vt.PLY=0]="PLY",Vt[Vt.AURORA=1]="AURORA",(Gt=exports.MarketAction||(exports.MarketAction={}))[Gt.Deposit=0]="Deposit",Gt[Gt.Borrow=1]="Borrow",Gt[Gt.Withdraw=2]="Withdraw",Gt[Gt.Repay=3]="Repay",Gt[Gt.EnableCollateral=4]="EnableCollateral",Gt[Gt.DisableCollateral=5]="DisableCollateral";var lr=function(e){function t(t){var n;return(n=e.call(this,t)||this).multicall=new r.Contract(E.misc.MULTICALL,w.abi,t.provider),n}return V(t,e),t.prototype.aggregate=function(){var e=H(Y().mark((function e(t){var n,a,o,i,s,u,c,p;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=[],a=0;case 2:if(!(a<t.length)){e.next=11;break}return i=t[a],e.next=6,(o=i.contract.populateTransaction)[i.method].apply(o,i.args);case 6:n.push({target:(s=e.sent).to,callData:s.data});case 8:a++,e.next=2;break;case 11:return e.next=13,this.multicall.callStatic.aggregate(n);case 13:for(u=e.sent,c=[],p=0;p<t.length;p++)c.push(r.ethers.utils.defaultAbiCoder.decode(t[p].returnTypes,u.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}(Ae),fr=function(e){function n(t){var r;return(r=e.call(this,t)||this).stakingRead=new ur(t),r.env=new Le(t),r}V(n,e);var a=n.prototype;return a.getUserDetails=function(){var e=H(Y().mark((function e(r){var n,a,o,i,s,u,c,p,l,f,d,h,m,w,y,v,g,b,k,x,A,P,_,L;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=E.auTokens.length,a=[],i=new t(0),s=K(E.auTokens);case 4:if((u=s()).done){e.next=23;break}return c=u.value,a.push(p={}),p.market=c.underlying,l=new qt(this._networkConnection,c.address,c.underlying),e.next=12,Promise.all([l.getUserDepositBalance(r),l.getUserBorrowBalance(r),l.getCollateralRatio(),dt(l.underlying.address,this._networkConnection.provider)]);case 12:d=(f=e.sent)[1],h=f[2],m=f[3],p.depositBalance=f[0],p.borrowBalance=d,p.collateralRatio=h.toNumber(),p.underlyingPrice=m.toString();case 21:e.next=4;break;case 23:return e.next=25,this.env.comptroller.getAssetsIn(r);case 25:o=e.sent,w=[],y=Y().mark((function e(){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=E.auTokens[v],a[v].isCollateral=void 0!==o.find((function(e){return ne(r.address,e)})),w.push(At(a[v].depositBalance,new t(a[v].underlyingPrice)));case 3:case"end":return e.stop()}}),e)})),v=0;case 29:if(!(v<n)){e.next=34;break}return e.delegateYield(y(),"t0",31);case 31:v++,e.next=29;break;case 34:return i=w.reduce((function(e,t,r){return a[r].isCollateral?e.plus(t.multipliedBy(a[r].collateralRatio)):e}),new t(0)),e.next=37,this.env.comptroller.getAccountLiquidity(r);case 37:for((g=i.minus(new t(e.sent[0].toString()).div(re(18)))).lt("0.00001")&&(g=new t(0)),b=i.multipliedBy(S),k=g.div(S),x=b.lte(g)?new t(0):b.minus(g),v=0;v<n;v++)P=new qt(this._networkConnection,(A=E.auTokens[v]).address,A.underlying),_=i.minus(k).gt(0)?i.minus(k):new t(0),L=_.div(a[v].collateralRatio).div(a[v].underlyingPrice),a[v].maxWithdrawableAmount=a[v].isCollateral&&L.lt(a[v].depositBalance.formattedAmount())?new Ce(P.underlying,L.toFixed(24),!1):new Ce(P.underlying,a[v].depositBalance.rawAmount());return e.t1=a,e.t2={currency:"USD",amount:b.toFixed(10)},e.next=48,new Xt(this._networkConnection).getLockingDetails(r);case 48:return e.t3=e.sent,e.t4={currency:"USD",amount:x.toFixed(10)},e.abrupt("return",{markets:e.t1,borrowLimit:e.t2,userLockingDetails:e.t3,borrowableAmount:e.t4});case 51:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),a.getTokenPrice=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,dt(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)}}(),a.calcHypotheticalStats=function(e){var r=e.userMarketDetail,n=e.currentBorrowValuation,a=e.action,o=e.tokenAmount,i=new t(e.currentBorrowLimit.amount),s=new t(n.amount);switch(a){case exports.MarketAction.EnableCollateral:case exports.MarketAction.DisableCollateral:var u=At(r.depositBalance,new t(r.underlyingPrice)).multipliedBy(r.collateralRatio).multipliedBy(S);i=a==exports.MarketAction.EnableCollateral?i.plus(u):i.minus(u);break;case exports.MarketAction.Deposit:case exports.MarketAction.Withdraw:u=At(o,new t(r.underlyingPrice)).multipliedBy(r.collateralRatio).multipliedBy(S),i=a==exports.MarketAction.Deposit?i.plus(u):i.minus(u);break;case exports.MarketAction.Borrow:case exports.MarketAction.Repay:var c=At(o,new t(r.underlyingPrice));s=a==exports.MarketAction.Borrow?s.plus(c):s.minus(c)}return{newBorrowLimit:{amount:i.toFixed(10),currency:"USD"},newBorrowUtilization:i.eq(0)?s.eq(0)?0:9999.99:s.div(i).toNumber()}},a.getPlyCirculatingSupply=function(){var e=H(Y().mark((function e(){var t,n,a,o,i;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new lr(this._networkConnection),n={contract:this.env.ply,method:"balanceOf",returnTypes:["uint256"]},a=[E.misc.TEAM_MULTISIG,E.misc.COMPTROLLER,E.misc.AURIFAIRLAUNCH,E.misc.PLY_TOKEN_LOCK,E.misc.TEAM_MULTISIG_AURORA_PLUS,E.misc.AURORA_PLUS,E.misc.PULP_CONTRACT].map((function(e){return q({},n,{args:[e]})})),e.next=6,t.aggregate(a);case 6:return o=e.sent,i=r.BigNumber.from("1"+"0".repeat(10)+"0".repeat(ue(this.env.ply.address))),o.forEach((function(e,t){i=i.sub(e[0])})),e.abrupt("return",new Ce(Te,i.toString()));case 10:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),a.getUtilisation=function(){var e=H(Y().mark((function e(r){var n,a,o;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.auriInternalLens.callStatic.getAccountLiquidityAccrueInterest(r);case 2:return a=new t((n=e.sent).sumBorrowPlusEffects.toString()),o=new t(n.sumCollateral.toString()),e.abrupt("return",a.dividedBy(o));case 6:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),a.sneakAccounts=function(){var e=H(Y().mark((function e(n,a,o){var i,s,u,l,f,d,h,m,w,y,v,g,b,k,x,A,P=this;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===o&&(o=new t(.1)),i=r.BigNumber.from(10).pow(18),s=this.env.getContract(E.misc.oracle,c.abi),u=a.map((function(e){return P.env.getContract(e,p.abi)})),e.next=6,s.getUnderlyingPrices(a);case 6:return l=e.sent,e.next=9,this.env.auriInternalLens.callStatic.getExchangeRates(a);case 9:f=e.sent,d=[],h=K(n);case 12:if((m=h()).done){e.next=33;break}w=m.value,y=[],v=0;case 16:if(!(v<u.length)){e.next=30;break}return e.next=19,u[v].getAccountSnapshot(w);case 19:if(b=(g=e.sent)[0].mul(f[v]).div(i).mul(l[v]).div(i),k=g[1].mul(l[v]).div(i),x=new t(b.toString()).dividedBy(i.toString()),A=new t(k.toString()).dividedBy(i.toString()),!x.lte(o)||!A.lte(o)){e.next=26;break}return e.abrupt("continue",27);case 26:y.push({token:ce(a[v]),deposit:x,borrow:A});case 27:++v,e.next=16;break;case 30:d.push({address:w,tokens:y});case 31:e.next=12;break;case 33:return e.abrupt("return",d);case 34:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),a.getNetApyWithoutIncentive=function(){var e=H(Y().mark((function e(r){var n,a,o,i,s,u,c,p=this;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new t(0),a=new t(0),o=new t(0),i=new t(0),e.next=6,Promise.all(E.auTokens.map((function(e){return new qt(p._networkConnection,e.address,e.underlying).getApyWithoutIncentive(r)})));case 6:for(s=K(e.sent);!(u=s()).done;)n=n.plus((c=u.value).sum),a=a.plus(c.suppliedValue),o=o.plus(c.borrowedValue);return n.gt(0)?i=n.div(a):n.lt(0)&&(i=n.div(o)),e.abrupt("return",i);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),a.getNetApyWithIncentive=function(){var e=H(Y().mark((function e(r){var n,a,o,i,s,u,c,p=this;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new t(0),a=new t(0),o=new t(0),i=new t(0),e.next=6,Promise.all(E.auTokens.map((function(e){return new qt(p._networkConnection,e.address,e.underlying).getApyWithIncentive(r)})));case 6:for(s=K(e.sent);!(u=s()).done;)n=n.plus((c=u.value).sum),a=a.plus(c.suppliedValue),o=o.plus(c.borrowedValue);return n.gt(0)?i=n.div(a):n.lt(0)&&(i=n.div(o)),e.abrupt("return",i);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n}(Ae),dr=function(e){function t(t){var r;return(r=e.call(this,t)||this).env=new Le(t),r}return V(t,e),t.prototype.getClaimableAmount=function(){var e=H(Y().mark((function e(t){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.env.plyTokenLock.callStatic.claimableBalance(t);case 2:return r=e.sent,e.abrupt("return",new Ce(new Re(Te.address,18),r.toString(),!0));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(Ae),hr=function(e){function t(){return e.apply(this,arguments)||this}return V(t,e),t.prototype.claim=function(){var e=H(Y().mark((function e(t,n){var a;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=r.BigNumber.from(n.rawAmount()),e.next=3,this.env.plyTokenLock.connect(this._networkConnection.signer).claim(t,a);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t}(dr),mr=function(e){function t(){return e.call(this)||this}V(t,e);var r=t.prototype;return r.read=function(e){return new dr(e)},r.readWrite=function(e){return new hr(e)},t}(_e);function wr(e,t){return yr.apply(this,arguments)}function yr(){return(yr=H(Y().mark((function e(t,r){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,A.post("https://api.aurigami.finance/notification/"+t,r,{headers:{"Content-Type":"application/json"}});case 2:return e.abrupt("return",e.sent.data);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var vr=function(e){function r(t){var r;return(r=e.call(this,t)||this).env=new Le(t),r._stakingRead=new ur(t),r._misc=new fr(t),r}V(r,e);var n=r.prototype;return n.getUserDetails=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),n.getPLYWNEARPoolDetails=function(){var e=H(Y().mark((function e(){return Y().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)}}(),n.getTokenPrice=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),n.stakeBalanceOf=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),n.LpBalanceOf=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),n.unclaimedRewardsOf=function(){var e=H(Y().mark((function e(t){return Y().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)}}(),n.calcHypotheticalStats=function(e){return this._misc.calcHypotheticalStats({userMarketDetail:e.userMarketDetail,currentBorrowLimit:e.currentBorrowLimit,currentBorrowValuation:e.currentBorrowValuation,action:e.action,tokenAmount:e.tokenAmount})},n.getPlyCirculatingSupply=function(){var e=H(Y().mark((function e(){return Y().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)}}(),n.getUtilisation=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._misc.getUtilisation(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.sneakAccounts=function(){var e=H(Y().mark((function e(r,n,a){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===a&&(a=new t(.1)),e.abrupt("return",this._misc.sneakAccounts(r,n,a));case 2:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),n.getNetApyWithoutIncentive=function(){var e=H(Y().mark((function e(t){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new fr(this._networkConnection),e.abrupt("return",r.getNetApyWithoutIncentive(t));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.getNetApyWithIncentive=function(){var e=H(Y().mark((function e(t){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new fr(this._networkConnection),e.abrupt("return",r.getNetApyWithIncentive(t));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.setUserNotificationSettings=function(){var e=H(Y().mark((function e(t,r,n,a,o){var i;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={address:t,mail:r,setting:{utilisation:n,liquidation:a},captchaResponse:o},e.next=3,wr("alert-setting/set",i);case 3:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})));return function(t,r,n,a,o){return e.apply(this,arguments)}}(),n.unsetUserNotificationSettings=function(){var e=H(Y().mark((function e(t,r){var n;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={address:t,mail:"",setting:{utilisation:null,liquidation:!1},captchaResponse:r},e.next=3,wr("alert-setting/set",n);case 3:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),n.getUserNotificationSettings=function(){var e=H(Y().mark((function e(t){var r;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={addresses:t},e.next=3,wr("alert-setting/get-user-setting",r);case 3:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r}(Ae),gr=function(e){function t(){return e.apply(this,arguments)||this}V(t,e);var r=t.prototype;return r.claim=function(){var e=H(Y().mark((function e(){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.env.auriLens.connect(this._networkConnection.signer).claimRewards(this.env.comptroller.address,this.env.auriFairLaunch.address,D));case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.stake=function(){var e=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new cr(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=H(Y().mark((function e(t){return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new cr(this._networkConnection).unstake(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t}(vr),br=function(e){function t(){return e.call(this)||this}V(t,e);var r=t.prototype;return r.read=function(e){return new vr(e)},r.readWrite=function(e){return new gr(e)},t}(_e);r.ethers.utils.Logger.setLogLevel(n.Logger.levels.ERROR),t.config({DECIMAL_PLACES:50}),exports.MAINNET_ADDRESSES=k,exports.TESTNET_ADDRESSES=x,exports.AIRDROP_END_TIMESTAMP=1651068e3,exports.AIRDROP_KEEP_THRESHOLD=604800,exports.AIRDROP_START_TIMESTAMP=1649858400,exports.ALL_STAKING_POOLS=D,exports.AURORA_CHAINID=1313161554,exports.AURORA_PLUS_API_PREFIX="https://aurora.plus/api/wallet/",exports.Airdrop=Ht,exports.AirdropRead=Yt,exports.AirdropReadWrite=jt,exports.AuriEnv=Le,exports.BORROW_LIMIT_BUFFER=S,exports.BORROW_NEAR_REWARDS_PER_WEEK=O,exports.BlockchainEntity=_e,exports.BlockchainEntityRead=Ae,exports.BlockchainEntityReadWrite=Pe,exports.CACHE_TIMEOUT=1e4,exports.DECIMAL_PRECISION=10,exports.DEPOSIT_NEAR_REWARDS_PER_WEEK=I,exports.DEPOSIT_ONLY_TOKENS=C,exports.ETHAddress=T,exports.HARDCODE_PRICE_TOKENS=M,exports.INF=U,exports.MiscRead=fr,exports.MoneyMarket=Zt,exports.MoneyMarketRead=qt,exports.MoneyMarketReadWrite=Kt,exports.ONE_DAY=86400,exports.ONE_WEEK=604800,exports.ONE_YEAR=31536e3,exports.PLYToken=Te,exports.PLYWNEARToken=Ee,exports.PLYWNEAR_POOL_ID=0,exports.PLYWNEAR_REWARD_TOKENS=N,exports.PRICE_WHITELISTED=B,exports.Papermill=Jt,exports.PapermillRead=Xt,exports.PapermillReadWrite=zt,exports.PlyGame=tr,exports.PlyGameRead=$t,exports.PlyGameReadWrite=er,exports.PlyTokenLock=mr,exports.PlyTokenLockRead=dr,exports.PlyTokenLockReadWrite=hr,exports.Pulp=ar,exports.PulpRead=rr,exports.PulpReadWrite=nr,exports.REFERRAL_CAMPAIGNS=F,exports.REWARD_CLAIM_START=1651759200,exports.Referral=sr,exports.ReferralRead=or,exports.ReferralReadWrite=ir,exports.SDK=br,exports.SD_INCENTIVE_IN_SD=83.35,exports.SdkRead=vr,exports.SdkReadWrite=gr,exports.Staking=pr,exports.StakingRead=ur,exports.StakingReadWrite=cr,exports.Token=Re,exports.TokenAmount=Ce,exports.TransferEventQuery=Lt,exports.abis=R,exports.assert=ee,exports.calcLMRewardApr=le,exports.calcNetApy=fe,exports.calcValuation=At,exports.decimalFactor=re,exports.decimalRecords=W,exports.devLog=ke,exports.dummyAddress="0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE",exports.dummyMarketAddress="0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f",exports.dummyPly=Se,exports.dummyPlyAurora=Ne,exports.dummyToken=Be,exports.dummyTokenAmount=De,exports.dummyTokenAmount2=Ie,exports.dummyTokenAmount3=Oe,exports.dummyUserMarketDetails=Me,exports.dummyZeroTokenAmount=Ue,exports.fetchHistoricalLPPositions=Rt,exports.fetchHistoricalLPPrice=Et,exports.fetchHistoricalPULPPrice=It,exports.fetchHistoricalPrice=Dt,exports.fetchHistoricalPriceByLP=Mt,exports.fetchHistoricalPriceFromOracle=St,exports.fetchLPPositions=$e,exports.fetchLPPrice=tt,exports.fetchPLYPrice=mt,exports.fetchPULPPrice=yt,exports.fetchPrice=dt,exports.fetchPriceFromCoingecko=ze,exports.fetchPriceFromCoingeckoAPI=Ke,exports.fetchPriceFromDefiLlama=Qe,exports.fetchPriceFromDefiLlamaAPI=Ve,exports.fetchPriceFromOracle=it,exports.fetchStNEARPrice=nt,exports.fetchToken0PriceByLP=gt,exports.fetchUnderlyingTokensPrices=ut,exports.fetchValuation=kt,exports.formatObject=te,exports.getApi=Ye,exports.getBlockBeforeTimestamp=ge,exports.getBlockTimestamp=de,exports.getBlocksTimestamp=ye,exports.getBlocksTimestampViaRPC=me,exports.getCurrentTimestamp=ae,exports.getDecimal=ue,exports.getPaginatedApi=He,exports.getQuery=Q,exports.getSymbol=ce,exports.getUnderlying=pe,exports.isSameAddress=ne,exports.networkAddresses=E,exports.queryGraphQL=J,exports.referralRewardDummy1=Fe,exports.referralRewardDummy2=We,exports.sleep=oe,exports.sortEvents=xe,exports.symbolRecords=Z,exports.validateAndParseAddress=se,exports.valuateToken=Pt;
2
2
  //# sourceMappingURL=sdk.cjs.production.min.js.map